My Computer Forum Computer Science Forum

Go Back   My Computer Forum > Computer Science Forum > Algorithms

Algorithms Algorithms and Data Structures - Analysis, Graph, Search, String, Sorting, Merge, Compression, Optimization, Quantum


Reply
 
LinkBack Thread Tools Display Modes
April 28th, 2008, 04:53 AM   #1
 
Joined: Apr 2008
Posts: 5
Merge Sort (Two types ?)

Hi , I was covering this topic over my notes, However there are two types of Merge Sort (Merge Sort 0 and Merge Sort 1) , Merge Sort 0 is recursive Where as Merge Sort 1 is not. Also Merge Sort 1 Uses a second array which we use to put the elements once we have established there correct position. What I wanted to know If I was asked this question.

1).Demonstrate how the merge sort algorithm merge_sort1 (which uses an extra
array to sort), sorts the array [7, 3, 1, 6, 2] into increasing order.

Compared to this Question.

2).Demonstrate how the merge sort algorithm merge_sort0 , sorts the array [7, 3, 1, 6, 2] into increasing order.

I know how to do the second question , but what worries me , how is this different to the first one (in terms of Demonstrating the answer ? )

Cheers
david cool is offline  
 

My Computer Forum is free to register and we welcome everyone!

April 28th, 2008, 09:53 AM   #2
 
Joined: Dec 2007
Posts: 232
Re: Merge Sort (Two types ?)

One has an extra array, the other doesn't.
CRGreathouse is offline  
April 29th, 2008, 03:25 AM   #3
 
Joined: Apr 2008
Posts: 5
Re: Merge Sort (Two types ?)

So if I was to explain how to sort an array (Human way of writing), it would be the same ?

Example

http://en.wikipedia.org/wiki/Image:Merg ... iagram.svg

Basically What I am saying is that if this was the example (in the link above)of sorting an array , the method of getting the answer is the exactly the same ? (Merge Sort 0 & Merge Sort 1 ) in terms of writing out the answer in a exam paper.


Cheers
david cool is offline  
April 29th, 2008, 11:45 AM   #4
 
Joined: Dec 2007
Posts: 232
Re: Merge Sort (Two types ?)

Quote:
Originally Posted by david cool
So if I was to explain how to sort an array (Human way of writing), it would be the same ?
No, why would it be? I'm confused as to why you think that. Inm fact, I'm confused about what you mean by "Human way of writing".

Also, I've never heard the two referred to as "merge_sort0" and "merge_sort1", and you won't hear that either after your class. Everyone else calls them recursive and non-recursive merge sort, respectively.
CRGreathouse is offline  
April 29th, 2008, 10:18 PM   #5
 
Joined: Apr 2008
Posts: 5
Re: Merge Sort (Two types ?)

Hi,

yeah sorry i can be a bit confusing sometimes lol. Ok forgetting that , how would you basically answer this question (my original problem).

A)Demonstrate how the merge sort algorithm merge_sort1 (which uses an extra
array to sort), sorts the array [7, 3, 1, 6, 2] into increasing order.


cheers
david cool is offline  
Reply

  My Computer Forum > Computer Science Forum > Algorithms

Tags
merge, sort, types



Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Database Types johnny Databases 11 January 2nd, 2014 06:33 AM
Automatic types conversion julien Programming 0 March 17th, 2013 08:20 AM
Heap Sort Help david cool Algorithms 2 April 27th, 2008 02:35 AM





Copyright © 2018 My Computer Forum Forum. All rights reserved.