0

Sort an array in c++.

Sort any array using fuction or loop

13th Oct 2020, 5:41 AM
Muhammad Adnan
Muhammad Adnan - avatar
3 odpowiedzi
+ 1
Use qsort() function syntax: qsort(arrayname,sizeof(array),sizeof(arraytype),comparing_function) https://www.geeksforgeeks.org/sort-c-stl/amp/ https://code.sololearn.com/ce2wAshGPaxw/?ref=app
13th Oct 2020, 5:56 AM
˜”*°•.˜”*°• Mohan 333 •°*”˜.•°*”˜
˜”*°•.˜”*°• Mohan 333 •°*”˜.•°*”˜ - avatar
+ 1
You can include algorithm header and use it sort function to sort any container which implemented random access iterator. you can also set execute policy which help container sorted faster in multithreaded form. but for sorting ANY array , you must implement a comparator routine(function).
13th Oct 2020, 11:45 AM
Pearl
Pearl - avatar
0
sort(arr, arr + (int)arr.size());
25th Oct 2020, 10:58 AM
Soheil
Soheil - avatar