• Overview An array is a linear data structure that collects multiple elements of the same type (usually) stored in contiguous memory locations. Elements are accessed using a numerical index. Core Concepts Indexing: Most languages use zero-based indexing, where the first element is at index 0. Contiguous Memory: Elements are stored side-by-side in memory, allowing for…

  • Overview AVL and Red-Black Trees are types of self-balancing Binary Search Trees (BSTs). In a standard BST, if elements are inserted in sorted order, the tree becomes a linked list (degenerate), leading to $O(n)$ time complexity for operations. Self-balancing trees use rotations and recoloring to maintain a height of $O(\log n)$, ensuring efficient search, insertion,…

  • Overview AVL and Red-Black trees are Self-Balancing Binary Search Trees (BSTs). In a standard BST, if elements are inserted in sorted order, the tree becomes a linked list (degenerate), leading to $O(n)$ search time. Self-balancing trees ensure the height remains $O(\log n)$ by rotating nodes during insertion and deletion. Core Concepts AVL Trees: Strict Balancing:…

  • Overview A variable is a symbolic name (identifier) that refers to a value stored in the computer’s memory. Unlike constants, the value held by a variable can be changed (mutated) during program execution. Core Concepts Declaration: Informing the compiler/interpreter that a variable exists (e.g., let x;). Initialization: Assigning an initial value to a variable (e.g.,…

  • Overview A type system is a logical framework that assigns a “type” (e.g., integer, string, boolean) to the various programs’ components. It is used by compilers and interpreters to ensure that operations are performed on compatible types, preventing a large class of runtime errors. Core Concepts Static vs. Dynamic Typing: Static Typing: Types are associated…

  • Overview Scope determines the visibility and lifetime of variables and functions in different parts of a program. It defines where an identifier can be accessed and where it is hidden from other parts of the code. Core Concepts Global Scope: Variables declared outside any function or block. They are accessible from anywhere in the program.…

  • Overview Recursion is a programming technique where a function calls itself to solve a problem. It is typically used to solve problems that can be broken down into smaller, identical sub-problems. Core Concepts Base Case: The condition under which the recursion stops. Without a base case, the function would call itself infinitely. Recursive Step: The…

  • Overview Loops are control flow structures that repeat a block of code as long as a specified condition is met. They are essential for processing collections of data or performing repetitive tasks without writing the same code multiple times. Core Concepts Iteration: A single pass through the loop’s body. Loop Types: For Loop: Best when…

  • Overview Immutability is the state of an object or value that cannot be modified after it is created. Instead of changing the existing data, any operation that would modify the value must create a new copy of the data with the changes applied. Core Concepts Mutable vs. Immutable: Mutable: The object can be changed in…

  • Overview A function is a reusable block of code designed to perform a specific task. Functions allow programmers to break complex problems into smaller, manageable pieces, reducing redundancy and improving maintainability. Core Concepts Declaration vs. Expression: Declaration: A named function defined in the global or local scope. Expression: A function assigned to a variable (often…