Quicksort Algorithm

Given an array of integers, sort it using quick sort algorithm.   Quicksort is an efficient in-place¬†sorting algorithm and can be about two or three times faster than its main competitors, merge sort and heapsort when implemented well.¬†

Merge Sort Algorithm

Given an array of integers, sort it using merge sort algorithm.     Merge sort is an efficient sorting algorithm which produces a stable sort, which means that the implementation preserves the input order of equal elements in the sorted output.

Bubble sort | Iterative & Recursive

Given an array of integers, sort it using bubble sort algorithm.     Bubble sort is a stable, in-place sorting algorithm that is named for the way smaller or larger elements “bubble” to the top of the list. Although the algorithm is simple, it is too slow and impractical for most problems even when compared …

Selection sort | Iterative & Recursive

Given an array of integers, sort it using selection sort algorithm. Selection sort is a unstable, in-place sorting algorithm known for its simplicity, and it has performance advantages over more complicated algorithms in certain situations, particularly where auxiliary memory is limited. It can be implemented as a stable sort.

Insertion sort | Iterative & Recursive

Given an array of integers, sort it using insertion sort algorithm.     Insertion sort is stable, in-place sorting algorithm that builds the final sorted array one item at a time. It is not very best in terms of performance but it is more efficient in practice than most other simple O(n2) algorithms such as …

Find Longest Possible Route in a Matrix

Given a rectangular path in the form of binary matrix, find the length of longest possible route from source to destination position of the matrix by moving to only non-zero adjacent positions i.e. route can be formed from positions having their value as 1. Note there should not be any cycles in the output path.