Skip to content
hakk
  • Home
  • Blog
  • Docs
  • DSA
  • Snippets

Concept

  • Big O Time & Space 2024-06-07

    The concept of Big O notation is fundamental in computer science and software engineering for analyzing and comparing the efficiency of algorithms and data structures. It provides a standardized way of describing the upper bounds of the time and space complexity of an algorithm or data structure as the input size grows.

    Big O Time Complexity:

    Big O time complexity describes the worst-case scenario for the amount of time an algorithm takes to complete as a function of the input size (n). It represents an upper bound on the time required for an algorithm to execute, ignoring constant factors and lower-order terms. In simpler terms, it tells us how the runtime of an algorithm scales with the input size.

  • Dynamic Programming (DP) 2024-06-07

    Dynamic Programming (DP) is a problem-solving technique used to solve problems by breaking them down into simpler subproblems. It is particularly useful when the problem can be divided into overlapping subproblems, meaning that the same subproblems are solved repeatedly. DP stores the results of solved subproblems in a table (usually an array or a matrix) to avoid redundant computations and improve efficiency.

    Here are some key concepts and characteristics of dynamic programming:

  • Recursion 2024-06-07

    Recursion is a programming technique where a function calls itself directly or indirectly to solve a problem. It’s a powerful and elegant approach commonly used to solve problems that can be broken down into smaller, similar subproblems.

    Here are some key points about recursion:

    1. Base Case: Recursion involves breaking down a problem into smaller instances of the same problem. Each recursive function call works on a smaller or simpler version of the original problem. Eventually, the problem becomes small enough that it can be solved directly without further recursion. This stopping condition is called the base case, and it prevents the recursion from continuing indefinitely, leading to a termination of the recursive process.

    2. Stack vs. Heap Memory 2024-06-07

      Stack and heap are two memory regions used by computer programs to manage memory allocation, each with its own characteristics and purposes.

      Stack Memory:

      • Purpose: The stack is used for static memory allocation and stores variables that are declared and initialized in functions and methods. It is a region of memory that follows a Last-In-First-Out (LIFO) structure.
      • Allocation: Memory on the stack is automatically allocated and deallocated as functions are called and return. When a function is called, space is allocated on the stack for local variables, function parameters, return addresses, and other bookkeeping information.
      • Access: Access to stack memory is fast and efficient because it involves simple pointer manipulation. Local variables can be accessed directly by their memory addresses relative to the stack pointer.
      • Size Limitations: The size of the stack is typically limited and fixed, defined by the operating system or runtime environment. Exceeding the stack size can lead to a stack overflow, causing program termination.
      • Lifetime: Stack-allocated memory is short-lived and automatically freed when the function or scope in which it is allocated exits.

      Heap Memory:

Recent posts
  • How to Update a File's Creation Time in PowerShell
  • How to Run PowerShell Code Only During Certain Times
  • PeopleSoft App Server Freeze Troubleshooting Checklist
  • Build Vim With Python3 Support
  • Understanding the ss Command: A Modern Alternative to netstat
© 2026 hakk
  • Home
  • Blog
  • Docs
  • DSA
  • Snippets