## Iterative Quick Sort

Following is a typical recursive implementation of Quick Sort that uses last element as pivot. C++ filter_none edit close play_arrow link brightness_4 code // CPP… Read More »

- Count distinct elements in an array
- Print the nodes of binary tree as they become the leaf node
- Rearrange Odd and Even values in Alternate Fashion in Ascending Order
- Sort the array of strings according to alphabetical order defined by another string
- Merge K sorted arrays | Set 3 ( Using Divide and Conquer Approach )
- Ternary Search
- Number of pairs whose sum is a power of 2
- Amazon Internship Interview Experience
- k-th missing element in an unsorted array
- Nagarro Interview Experience Off-campus
- Merge K sorted arrays of different sizes | ( Divide and Conquer Approach )
- Check if array can be sorted with one swap
- Smallest subarray containing minimum and maximum values
- Find closest value for every element in array
- Sort the array in a given index range
- Maximum sum by picking elements from two arrays in order
- Sort an array of string of dates in ascending order
- Python | Sort list of list by specified index
- Array element with minimum sum of absolute differences
- Split the array elements into strictly increasing and decreasing sequence
- Comparison among Bubble Sort, Selection Sort and Insertion Sort
- Average of remaining elements after removing K largest and K smallest elements from array
- Find the minimum number of rectangles left after inserting one into another
- Delete odd and even numbers at alternate step such that sum of remaining elements is minimized
- Iterative selection sort for linked list
- Minimum operations to make frequency of all characters equal K
- Check if words are sorted according to new order of alphabets
- Make palindromic string non-palindromic by rearranging its letters
- Minimum operations of given type to make all elements of a matrix equal
- Leftmost and rightmost indices of the maximum and the minimum element of an array

Following is a typical recursive implementation of Quick Sort that uses last element as pivot. C++ filter_none edit close play_arrow link brightness_4 code // CPP… Read More »

filter_none edit close play_arrow link brightness_4 code // Java implementation of iterative quick sort class IterativeQuickSort { void swap(int arr[], int i, int j) {… Read More »

filter_none edit close play_arrow link brightness_4 code // An iterative implementation of quick sort #include <stdio.h> // A utility function to swap two elements… Read More »

Given N machines. Each machine contains some numbers in sorted form. But the amount of numbers, each machine has is not fixed. Output the numbers… Read More »

Given a number, find the next smallest palindrome larger than this number. For example, if the input number is “2 3 5 4 5”, the… Read More »

Given an array of n elements, where each element is at most k away from its target position, devise an algorithm that sorts in O(n… Read More »

Given an array of integers, find any one combination of four elements in the array whose sum is equal to a given value X. For… Read More »

Given an unsorted array and a number n, find if there exists a pair of elements in the array whose difference is n. Examples: Input:… Read More »

Given an array and a value, find if there is a triplet in array whose sum is equal to the given value. If there is… Read More »

Given two Linked Lists, create union and intersection lists that contain union and intersection of the elements present in the given lists. Order of elments… Read More »

Given two arrays: arr1[0..m-1] and arr2[0..n-1]. Find whether arr2[] is a subset of arr1[] or not. Both the arrays are not in sorted order. It… Read More »

The problem of sorting can be viewed as following. Input: A sequence of n numbers <a1, a2, . . . , an>. Output: A permutation… Read More »

Minimizing the number of writes is useful when making writes to some huge data set is very expensive, such as with EEPROMs or Flash memory,… Read More »

What is it? A sorting algorithm is said to be stable if two objects with equal keys appear in the same order in sorted output… Read More »

The answer depends on strategy for choosing pivot. In early versions of Quick Sort where leftmost (or rightmost) element is chosen as pivot, the worst… Read More »