1 – Why should audience care ?

Answer the one question that matters most , why your audience should listen to you any way… read more at 7 Things You Need to Present like Steve Jobs

## 7 Things You Need to Present like Steve Jobs, regardsAli.com

24 09 2011Comments : Leave a Comment »

Categories : Uncategorized

## Quick Sort Algorithm C#

11 12 2007The quick sort is an in-place, divide-and-conquer, massively recursive sort. As a normal person would say, it’s essentially a faster in-place version of the merge sort. The quick sort algorithm is simple in theory, but very difficult to put into code.

The recursive algorithm consists of four steps:

- If there are one or less elements in the array to be sorted, return immediately.
- Pick an element in the array to serve as a “pivot” point. (Usually the left-most element in the array is used.)
- Split the array into two parts – one with elements larger than the pivot and the other with elements smaller than the pivot.
- Recursively repeat the algorithm for both halves of the original array.

The quick sort is by far the fastest of the common sorting algorithms. It is possible to write a special-purpose sorting algorithm that can beat the quick sort for some data sets, but for general-case sorting there isn’t anything faster.

The quick sort is recursive, which can make it a bad choice for applications that run on machines with limited memory.

### Quick Sort Routine

// array of integers to hold values private int[] a = new int[100]; // number of elements in array // Quick Sort Algorithm public void q_sort( int left, int right ) l_hold = left; while( left < right ) if( left != right ) while( (a[left] <= pivot) && (left < right) ) if( left != right ) a[left] = pivot; if( left < pivot ) if( right > pivot ) |

You can download the full code here, or the compiled code here.

for further go to : http://www.publicjoe.f9.co.uk/csharp/sort05.html

Comments : Leave a Comment »

Categories : Uncategorized