Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » How to set the sort function? Collapse All
Subject Author Date
zhang jin Feb 20, 2013 - 7:53 PM


Double-click the header of each column,the column is sorted in ascending or descending order. I have set the flag of __EGWS_BSE_SORT_COLUMNS,but it doesn’t work.What should I do?

mike dukes Oct 26, 2020 - 7:24 AM

Sort() function
It is a built-in function of algorithm header file it is used to sort the containers like an array, vectors in a specified order. Internally this function is implemented as Quick-sort
Quicksort is a divide and conquer algorithm. Quicksort first divides a large list of elements into two smaller sub-lists: the lower elements and the higher elements. Quicksort then recursively sort the sub-lists.

The steps are as follows:
1. Pick a random element(usually the last element), called a pivot, from the list.
2. Reorder the list in a way such that all elements with values less than the pivot come before the pivot, while all elements with values greater than the pivot come after it and equal values can go either way this is process is called partition operation.
3. Recursively sort the sub-list of lesser elements and the sub-list of greater elements, again select a pivot in sub-list and divide them.
The base case of the recursion is lists of size zero or one, which never need to be sorted and thus by combining them we sort our list.

Quicksort is faster in practice than other O(n log n) algorithms such as Insertion Sort or Bubble sort. Quicksort can be implemented with an in-place partitioning algorithm which means the entire sort can be done with only O(log n) additional space. Quicksort is not a stable sort.