
Pivot Element
Choose your prefered Language:


Consider a one-dimensional table of integers of positive N-location numbers (N = known).
- Enter values in the table using random numbers in the [1.99] range.
- Specify the pivot element in the original (1st position) of the table. Distribute the by table, creating a new table in two sections as follows:
- the new table includes in its first section, in ascending order, no use
- grading process, all values in the original table that are smaller than or equal to
- value in the pivot position. Then there is the value of the pivot position and follow, at
- second part, the values of the original table that are greater than the value present in
- pivot position, as they appear in the original table, from left to right.
Print the two tables
Example if N=10:
7 | 2 | 7 | 14 | 16 | 3 | 8 | 1 | 27 | 5 |
new array:
1 | 2 | 3 | 5 | 7 | 7 | 14 | 16 | 8 | 27 |