Go Back   TestMagic Forums > Test preparation > GRE Subject Tests > GRE Computer Science
Register Forum Rules FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 2009 October 19th, 06:46 AM   #11 (permalink)
I JUST got here.
 
Join Date: Oct 2009
Posts: 2
dwarf just joined TestMagic.
Well the best case for merge sort is C1 n log n (if you solve the recurrence it is close to be 1/2 n log n). The worst case is C2 n log n (where C2 = 1).

If you see the difference, it is n logn - 1/2 n log n = 1/2 n log n = 50% more comparisons.

According to wikipedia it is actually 26.45% more compared to the average case.

For Selection Sort, if I take your argument to be true, then best case = n^2.
Worst Case = n^2 + n. (no difference in constant for the higher order term n^2).

If n = 600 (which is very low for real inputs)
n^2 + n is only 0.167% more than n^2.

Now which is faster, 24% more comparisons than the average case (or 50% more than the best case) or 0.1% more than the worst case. The difference is even more pronounced if you take n = 6 million.

In my humble opinion the answer to this question by ETS... needs to be revised.!
dwarf is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Google Bookmark this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

What you can do
You cannot post new threads
You cannot post replies
You cannot post attachments
You cannot edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 11:49 AM.

Contact TestMagic   TestMagic Forums      Archive   Privacy Statement

TestMagic Locations   Legal   Privacy


SEO by vBSEO 3.2.0
Copyright © 2009 TestMagic
Ad Management by RedTyger

Scroll Up