Quick Sort AKU 2019 DSA Quick Sort Sort the given values using quicksort and write time complexity of algorithm : 65, 70, 75, 80, 85, 60, 55, 50, 45 Sol: Quick sort algorithm is sorting Algorithm based on Partition technique. In this algorithm first we select pivot element. This pivot element can be any one. Now we have to take two pointer one is i at left side to the given list another one is j at right side to the given list. If pivot item pointed by i is smaller than pivot element then increment i by 1 and if item pointed by j is greater than pivot element then decrement j by 1 If above both condition is not true or can say false then simply swap element pointed by i and j Second case may happen when j cross i if yes then simply interchange pivot element by element pointed by j This is the working principal of Qu...
Posts
- Get link
- X
- Other Apps
Define collision in hashing. What are the different methodologies to resolve collision? Explain briefly. Purpose of hashing is to reduce searching time in an array. Without hashing searching time is O(n) whereas with hash function it takes only O(1) time. To reduce searching time Hashing technique uses Hash function. For Example H(Key)= Key Mod 10 Where, Key is the element which we want to store in an array and 10 is the size of an array in which we want to store element. Hash function returns array index where we insert element into the array. Lets suppose we want to insert element like 10,50,23, 45 into the array. So first we need to insert element 10 into an array. So will apply function on this element for index position of array where we want to insert an element like H(10) = 10 Mod 10 = 10 that means element 10 will store at index 0 in an array. Now next element which we want ro insert in an array is 50 so apply hash function on this element also like belo...