Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

understanding merge sort

19 views
Skip to first unread message

josh

unread,
Dec 16, 2011, 11:19:51 PM12/16/11
to
Here is the code (including the test).
http://pastebin.com/QH46wghT

it's working but i don't understand why this line:
merge_sort(a2)
works. I would think of doing this: a2 = merge_sort(a2) since i don't
see where are we assigning the return value of merge_sort into a2.

I guess there is something with recursion that I completely miss...
Thanks!


sreservoir

unread,
Dec 17, 2011, 11:39:23 AM12/17/11
to
it's an in-place sort.

David Combs

unread,
Jan 21, 2012, 9:37:47 PM1/21/12
to
In article <jcigjr$4vm$1...@dont-email.me>,
Maybe check out wikipedia, via googling merge sort.

David


Robert Klemme

unread,
Jan 22, 2012, 7:05:25 AM1/22/12
to
Wikipedia is a good source. But I think a good book about algorithms
and data structures (e.g. Sedgewick) should be on anyone's shelve who is
doing programming.

Kind regards

robert

--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/
0 new messages