/DSA

Primary LanguageC++MIT LicenseMIT

DSA

Study Material

Topic wise

Array

S.No. Problem Approach Time complexity Space complexity Status
1. Reverse an array Two pointer method O(n) O(1)
2. (a) Find min max in an array linear search method O(n) O(1)
2. (b) Find min max in an array tournament method O(n) O(1)
2. (c) Find min max in an array pair comparision method O(n) O(1)
3. Find kth smallest and highest element in an array Partition method O(n2) O(1)
4. Given an array which consists of only 0, 1 and 2. Three pointer approach O(n) O(1)
5. (a) Arrange all negative elements on one side Partition method O(n) O(1)
5. (b) Arrange all negative elements on one side Two pointers method O(n) O(1)
6. Arrange union and intersecion count. Pointers method O(n1+n2) O(1)

Sorting

S.No. Problem Approach Time complexity Space complexity Status
1. Bubble sort O(n2) O(1)
2. Selection sort O(n2) O(1)
3. Insertion sort O(n2) O(1)
4. Quick sort Partition method O(n2) O(1)
5. Merge sort Divide and conquer O(nlogn) O(n)