[hotjoe.com] HotJoe Java Help Forums
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Visit java.com
Please send email if you are having login problems - see the posts below for more info.
Hotmail and Yahoo! users - please see the Hotmail post or the Yahoo! post for information on lost emails.
java question  XML
Forum Index » Java Programming
Author Message
mona

Newbie

Joined: 03/19/2006 03:44:03
Messages: 2
Offline

HI

Plz if someone can help me with the following question


Show the steps involved in sorting the following array of names into ------alphabetical order using the Merge sort algorithm.

----------------------------------------------------
Neo - Trinity - Morpheus- Smith - Cypher-
----------------------------------------------------

Thanks

Mona
destin

Newbie
[Avatar]
Joined: 01/07/2006 19:13:04
Messages: 224
Offline

Well, obviously before you answer this you're going to need to know what the merge sort algorithm is and how it works. If you don't already know, here's an article on wikipedia that explains it. If you do know, then what part of it are you having trouble with?
[Email]
mona

Newbie

Joined: 03/19/2006 03:44:03
Messages: 2
Offline

i can understand the merge sort be reading thrugh that doc. considering following pseudocode for the Merge sort algorithm For the above array of 5 elements iam not able to list all the calls to mergeSort that will be made, clearly indicating the actual parameters for each invocation of the method. Plz if anyone can at least demonstarte the calls

Array version: A is the array to be sorted

METHOD mergeSort(A, lowerBound, upperBound)
IF A contains more than one element
middle = (lowerBound + upperBound) / 2
mergeSort(A, lowerBound, middle)
mergeSort(A, middle+1, upperBound)
merge(A, lowerBound, middle+1, upperBound)
ENDIF
ENDMETHOD


thax
Mona
 
Forum Index » Java Programming
Go to:   
Powered by JForum 2.1.9 © JForum Team
This site run by Scott Dunbar of Xigole Systems. © 2005-2011 - Scott Dunbar
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners
hotjoe.com, xigole.com, and Scott Dunbar have no affiliation with Oracle