Quantcast
Viewing all articles
Browse latest Browse all 40121

Difference between qsort() and sort() ?

I tried solving the question HORSES < http://www.codechef.com/problems/HORSES> , according to my algorithm, I had to sort the array and compare the adjacent entries for minimum difference. My solution where I used qsort function of stdlib.h gave a WRONG ANSWER whereas when I used sort function of algortithm header file, it got accepted.

Whats the difference between the two sorting functions? and is the use of algorithm.h only limited to C++ ?

MY SOLUTIONS using sort() which got accepted http://www.codechef.com/viewsolution/3653269

using qsort of stdlib.h which gave a wrong answer http://www.codechef.com/viewsolution/3652347


Viewing all articles
Browse latest Browse all 40121

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>