/ds-algo

Primary LanguageJava

Data Structures and Algorithms

Comparing Algorithms

  • Understanding Big O notations
    • O(1) < O(log n) < O(n) < O(n log n) < O(n^c) < O(n!)
      • where, c is a constant like 2,3,4 i.e., O(n^2), O(n^3) and so on.
      • and n! is the factorial of n which is the worst time complexity

Algorithms

  • Searching
    • Linear Search
    • Binary Search
  • Sorting
    • Bubble Sort
      • Worst Case: O(n^2)
      • Average Case: O(n^2)
      • Best Case: O(n)
    • Quick Sort
      • Worst Case: O(n^2)
      • Average Case: O(n log n)
      • Best Case: O(n log n)
    • Insertion Sort
      • Worst Case: O(n^2)
      • Average Case: O(n^2)
      • Best Case: O(n)
    • Selection Sort
      • Worst Case: O(n^2)
      • Average Case: O(n^2)
      • Best Case: O(n^2)
    • Merge Sort
    • Heap Sort

Data Structures

  • Stack
  • Queue
  • Linked List
    • Reverse a Linked List
  • HashMap
  • Tree
    • Invert a Binary Tree
    • BFS
    • DFS
  • Graph
  • Heaps
    • Min Heap
    • Max Heap