Skip to content

Latest commit

 

History

History

239-as-quick-as-a-flash

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

As quick as a flash

Challenge Description:

We have just received an extremely important information that needs to be sorted. The amount of information is huge, and we need to sort it as soon as possible. That is why we decided to use a quick sort algorithm.

Input sample:

The first argument is a path to a file. Every row includes a test case with numbers that you need to sort using quick sort algorithm.

5 2 6 1 3 4
1 2 3 4
4 3 2 1
3 1 2 4
1 3 2 4

Output sample:

You need to calculate and print number of pivots in the array during sorting. This would mean how many times the array was divided into left and right subarrays.
Pivot is an element which divides an array. If array/subarray has only one element this element is not a pivot.

4
3
3
2
2

Constraints:

  1. The test case can include from 1 to 30 elements.
  2. The number of test cases is 40.