MedVision ad

sort (1 Viewer)

xeriphic

Member
Joined
May 7, 2004
Messages
452
Location
Sydney
for the sorting question that said changed the array to 10000 values, which would be the most suitable sorting method ?? I chose insertion hmm, or maybe it should be selection
 

AE86

Member
Joined
Jun 12, 2004
Messages
73
Gender
Male
HSC
2004
I choose insertion too because it's sorted passes are always ordered for each pass and doesn't necessarily need to look at all the thousands of elements in one pass

Bubble would be a failure in doing this.

Selection would also take a long time since it needs to look at all the elements after the sorted ones.
 

raidan

Member
Joined
Oct 30, 2004
Messages
44
Location
Sydney, The Shire
Gender
Male
HSC
N/A
I did selection sort for that one, basically said that because it only technically needs to go through the algorithm 1 time, whereas the bubble sort has to keep going back through the algorithm until all the high numbers have been swapped around till they are at the back of the array. I cant remember what my argument about insetion sort was, i think it was pretty lame though. I dont expect to go that well for that question, sorta BS'd :(
 

MedNez

:o>---<
Joined
Aug 21, 2004
Messages
3,004
Gender
Male
HSC
N/A
AE86 said:
I choose insertion too because it's sorted passes are always ordered for each pass and doesn't necessarily need to look at all the thousands of elements in one pass
Yep, that's what I put. Was only that or selection anyway.
 

xeriphic

Member
Joined
May 7, 2004
Messages
452
Location
Sydney
raidan said:
I did selection sort for that one, basically said that because it only technically needs to go through the algorithm 1 time, whereas the bubble sort has to keep going back through the algorithm until all the high numbers have been swapped around till they are at the back of the array. I cant remember what my argument about insetion sort was, i think it was pretty lame though. I dont expect to go that well for that question, sorta BS'd :(
didn't see this post, I was thinking that bubble and selection are quite similar, considering they both have to keep on passing through the array
 

ZzJasonzZ

Member
Joined
Mar 25, 2004
Messages
36
Location
Sydney
i worked it out so i talked about bubble in part i... then looked at part iii decided that insertion was the one that was the best so i talked about selection in part ii covering all 3 sorts in the section
 

xeriphic

Member
Joined
May 7, 2004
Messages
452
Location
Sydney
MedNez said:
Yep, that's what I put. Was only that or selection anyway.
yes a chance of 1/2 to get it right, great odds huh lol

I wonder if anyone recommended bubble again for the most suitable question lol, that would be funny if they were able to provide suffient reasons and get the marks
 

scorpi0n

New Member
Joined
Oct 28, 2004
Messages
19
Gender
Male
HSC
2004
yep did insertion...seems to be the only one that doesn't have to go through the whooooole 10,000 elements every time.
 

Jebu

New Member
Joined
Sep 17, 2004
Messages
16
As i just said in another thread, insertion will start with 0+1+2+3+...+9,999 as with each pass the sorted area grows, and comparisons have to be made with it. Alternatively, with selection sort the first pass will take 10,000, then 9,999....1 (as the sorted area does not have to be checked, the value simply has to be swapped into the first unsorted position) etc.. down to 1. Hence same amount of searches? or is it just me who sees this logic?
 

ZzJasonzZ

Member
Joined
Mar 25, 2004
Messages
36
Location
Sydney
Jebu said:
As i just said in another thread, insertion will start with 0+1+2+3+...+9,999 as with each pass the sorted area grows, and comparisons have to be made with it. Alternatively, with selection sort the first pass will take 10,000, then 9,999....1 (as the sorted area does not have to be checked, the value simply has to be swapped into the first unsorted position) etc.. down to 1. Hence same amount of searches? or is it just me who sees this logic?
it is the same amount of searches but it has to search through all 10,000 elements to find the next max value, where as an insertion only needs to shuffle it doesnt need to go through all 10,000 elements to find the max then go through all 9,999 to find the next max, etc etc
 

PoP 'n' Fresh

Poke me! I giggle!
Joined
Aug 23, 2004
Messages
193
Location
Manly
Gender
Male
HSC
2005
i said insertion, but seeing as it was a huge array, i changed it slightly so it did a binary search to place the element in the required position??? wtf that doesnt make sense now i dont think... its ordered.... argh my brain
 

xeriphic

Member
Joined
May 7, 2004
Messages
452
Location
Sydney
PoP 'n' Fresh said:
i said insertion, but seeing as it was a huge array, i changed it slightly so it did a binary search to place the element in the required position??? wtf that doesnt make sense now i dont think... its ordered.... argh my brain
binary search ?? ehhhhh lol
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top