|
|||
|
qsort function is used for sorting elements in an array given. It takes parameter as pointer to first element of the array given for sorting, the size of each of the array element in bytes, number of elements in array, pointer to elements of array.
|
|
|||
|
Hightlight the purpose..qsort() & bsearch()
Hi,
qsort() function is used to sort a big array or a linked list. It is a kind of sorting where a key is found out by using some formula and is placed at the center of the array. Then you sort the array using some logic. If you want i can explain with an example. bsearch() function is used to search for an element in the array. There are basically two types of searches. 1. Linear search 2. Binary Search ( bsearch()) For linear search you keep search for an element irrespective of the array is sorted or not. but in case of binary search the pre requisite is that the array must be in sorted in order, if not then first thing is to sort the array and then perform the search. I can also explain this also. As your query was just to know the purpose of these two functions so i did not explain with an example. If you really feel i can explain them with an example. I hope i have cleared your doubt. Regards, Bangalore |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Highlight on Drawback | Ralph | MySQL | 2 | 04-11-2007 06:28 AM |
| Which has higher priority- Somebody throw highlight on this? | Allan | C and C++ | 1 | 04-07-2007 09:12 AM |
| Highlight the Difference | priyaraji | Oracle Database | 2 | 12-14-2006 06:11 AM |
| comp.archives.ms-windows.{announce,discuss} FAQ | Timo Salmi | Tech FAQ | 0 | 06-04-2004 08:06 AM |
| comp.archives.ms-windows.{announce,discuss} FAQ | Timo Salmi | Tech FAQ | 0 | 05-04-2004 08:06 AM |