Hackerrank - Quicksort 2 - Sorting
     Problem Submissions Leaderboard Discussions In the previous challenge, you wrote a partition   method to split an array into two sub-arrays, one containing smaller  elements and one containing larger elements than a given number. This  means you 'sorted' half the array with respect to the other half. Can  you repeatedly use partition  to sort an entire array?   Guideline   In Insertion Sort, you simply went through each element in order and  inserted it into a sorted sub-array. In this challenge, you cannot focus  on one element at a time, but instead must deal with whole sub-arrays,  with a strategy known as "divide and conquer".   When partition  is called on an array, two parts of the array get 'sorted' with respect to each other. If partition   is then called on each sub-array, the array will now be split into four  parts. This process can be repeated until the sub-arrays are small.  Notice that when partition is called on just one of the numbers, the...
Comments
Post a Comment