Linear Data Structures

  • Array: Fixed-size, index-based. O(1) access.
  • Linked List: Dynamic size; each node holds data and a pointer to the next node.
  • Stack: LIFO (Last In, First Out). Push and Pop operations. Used in recursion, undo.
  • Queue: FIFO (First In, First Out). Enqueue and Dequeue. Used in scheduling.

Non-linear Data Structures

  • Tree: Hierarchical. Binary Search Tree: left < root < right.
  • Graph: Nodes connected by edges. Directed or undirected.

Sorting Algorithms

  • Bubble Sort — O(n²)
  • Selection Sort — O(n²)
  • Merge Sort — O(n log n)
  • Quick Sort — O(n log n) average