various data structures and algorithms and interview questions
-
Bubble Sort
-
O(1) ~ O(N^2)
-
Selection Sort
-
Insertion Sort
-
O(1) ~ O(N^2)
-
Merge Sort
-
Divide : O(log n) Merge : O(n) O(n log n)
-
Quick Sort - Quick sort is a highly efficient sorting algorithm and is based on partitioning of array of data into smaller arrays. ... Quicksort partitions an array and then calls itself recursively twice to sort the two resulting sub arrays.
- Quick Sort : Java
- [Counting Sort : Kotlin] - todo;
- Test Case
-
Bucket Sort - Todo
-
Counting Sort - Unlike above comparision based algorithms, Counting sort is a sorting technique based on keys between a specific range.
-
Best Case : O(k) where K is the max Worst Case : O(n) Overall O(n + k ) -> O(n)
-
Linear Search
-
Binary Search
Using Recursion Time : O(log2 n) Storage : O(n) // since it uses stack for recusion calls Using Iteration Time : O(log2 n) Storage : O(1) Prefer Recussion apporach :)
-
Ternary Search
-
Using Recursion Time : O(log3 n)
-
Hash Map - Implemented using Chaining method to avoid collation
-
Stack - Implementation for the Stack (LIFO)
-
Queue - Implementation for the Queue (FIFO)
-
Queue (With Two Stacks) : Kotlin
-
enqueue(item : T) - 0(1)
peek and pop O(N) -
Since we have to move items from primary stack to the other
-
-
Dynamic Array - Implementation for the Array List (Dynamic Array)
Linked List - Implementation for the Linked List