We already know we have to divide an array into two sub-array for quicksort algorithm. Here I’ll describe how this partitioning actually works. If you want to know about how quicksort works, follow my other post on quicksort working principle. I followed Introduction to Algorithms, 3rd Edition (MIT Press) for writing this tutorial.
QuickSort is the most elegant sorting algorithm with an average case time complexity of O(nlogn). The main idea behind quick sort is divide and conquer. I’ll try to explain how this divide and conquer strategy works for quick sort. This writing is a gist from Introduction to Algorithms, 3rd Edition (MIT Press), a cool book for … Continued
Finding an integer pair with given sum is a very familiar problem in algorithm community. The general problem is: given an array of integer numbers and a given sum, how do we find out a integer pair with given sum?
People follow many approaches to detect loop in linked list. Here I’m going to discuss about two approaches. Both approaches can be used on a singly linked list or doubly linked list.