Data Structures and Algorithms πππ
Quick info of Data Structures and Algorithms to code these data structures
Searching Techniques
Binary Search Iterative
Binary Search Recursive
Sorting Techniques
1. Quick Sort / Partition Sort
Partition procedure
Select the pivot element which is the first element of the array
Mark first element as
'i'and the last element as'j'Increment
iifarr[i] <= pivotDecrement
jifarr[j] > pivotAfter incrementing
iand decrementing j as per the last two steps, swap arr[i] and arr[j]Once
icrossesj, in other words, ifj>ithen swaparr[j] with pivotand return j
Now, after the partition procedure, we'll get two parts, the left partitioned and the right partitioned part. Perform quick sort recursively on both these parts.
Time-complexity of quicksort
If the list is sorted in ascending or descending order then the list is traversed 1+2+3+4...+n so it'
n^2The worst case is therefore
n^2The best case happens when
jappears at the center of the list. In this case, it will benlogn
2. Bubble Sort
3. Selection Sort
4. Merge Sort
5. Count Sort
6. Radix Sort
7. Bin / Bucket Sort
8. Shell Sort
Linked List
Operations
Display linked list
Insert an element at first place (head)
Insert an element at last place
Insert an element at any place (index)
Get the element at an index
Delete an element
Delete all elements
Reverse linked list (2 ways -> copy to array and back, reverse links)
Concatenate two linked lists
Merge two linked lists
LinkedList vs Array

Last updated
Was this helpful?