Les06_MergeSort_demo - public static void...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: public static void mergeSort(Comparable a, int left, int right) { if (left < right) { int middle = (left+right) / 2; mergeSort(a, left, middle); mergeSort(a, middle+1, right); merge(a, left, middle, right); } } public static void mergeSort(Comparable a, int left, int right) { if (left < right) { int middle = (left+right) / 2; mergeSort(a, left, middle); mergeSort(a, middle+1, right); merge(a, left, middle, right); } } public static void mergeSort(Comparable a, int left, int right) { if (left < right) { int middle = (left+right) / 2; mergeSort(a, left, middle); mergeSort(a, middle+1, right); merge(a, left, middle, right); } } 8, 9, 1 9, 8, 9 18 left right middle 8, 9, 1 8, 9, 1 9, 8, left left right right middle 9, 8, 1 left left right right ...
View Full Document

This note was uploaded on 08/18/2011 for the course COMP 3868 taught by Professor Keithchan during the Summer '97 term at Hong Kong Polytechnic University.

Ask a homework question - tutors are online