[Home]  [Edit this page]  [Recent Changes]  [Special Pages]  [Help
MergeSort
Displaying differences between revision 1 and the latest revision


= ([b[ComputerScience | Computer science]]) Merge Sort[/b] =

This is where two items are sorted, then another two items. Next, those total four items are ordered. The process continues again until the next four are sorted, then those first eight are then sorted. The pattern continues until everything is sorted.

Algorithm:[br]
1. If the input sequence has only one element, return.[br]
2. Partition the input sequence into two halves.[br]
3. Sort the two subsequences using the same algorithm.[br]
4. Merge the two sorted subsequences to form the output sequence.

Here's a Java animation if you need some help visualizing this: http://www2.ics.hawaii.edu/~qizhang/ics665/mergesort.html



last edited (November 2, 2006) by bilderbikkel, Number of views: 7956, Current Rev: 2 (Diff)

[Edit this page]  [Page history]  [What links here]  [Discuss this topic]  [Printer Friendly]  
© 1996-2008 Community Networks Ltd. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited. Violators of this policy may be subject to legal action. Please read Terms Of Use and Privacy Statement for more information. Site Management by Lars Hagelin at Kontantkort.se.