Bubble Sort
Selection Sort
Insertion Sort
Merge Sort
Quick Sort
Heap
Stack
Queue
Sliding Window
Binary Search
Two Pointers
Linked List
Sieve of Eratosthenes
  • Bubble Sort

    Bubble Sort is a simple comparison-based sorting algorithm. It repeatedly steps through the list, compares adjacent elements, and swaps them if they are in the wrong order. This process continues until the list is sorted.

    Time Complexity:

    Best Case: O(n) (when the array is already sorted)

    Average and Worst Case: O(n²) (due to nested loops for comparison and swapping)

    Space Complexity:

    O(1) (in-place sorting; no extra memory is required apart from a few variables for swapping)

    Bubble Sort is not suitable for large datasets due to its inefficiency. However, it is simple to implement.