How to code Sorting the index | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to code Sorting the index

Eg: {1,2,3,6,7,5,4,8} o/p : The array sorting from 3 to 6\\index value

23rd May 2020, 6:55 AM
Keerthana Arumugam
Keerthana Arumugam - avatar
2 Answers
+ 2
Sort array by comparisons of values of array
23rd May 2020, 6:59 AM
Shahghasi Adil
Shahghasi Adil - avatar
0
There are varies way to sorting.. For this case, quick sort will be better.. Choose 6 as, pivot and add all <6 to left, >6 to right.. Then 1,2,3,4, 5 6 7,8 now it is in sorted order,.. Simple way is bubble sort but time consuming.. https://www.sololearn.com/learn/774/?ref=app Indexes are already in sorted order..
23rd May 2020, 12:29 PM
Jayakrishna 🇮🇳