CS241 Study Guide - Merge Sort, Sudo, Sorting Algorithm

59 views32 pages
8 Oct 2014
Course
Professor

Document Summary

;i implemented mergesort which takes o(nlogn) time which i learned both in cs136 and cs240. ;i followed some sudo code form my cs240 slides to implement it. ;there is two functions which have the labels mergesort and merge. ;mergesort sorts the array by divide and conquer. ;first i slit the array into two more arrays b: length n/2 and c: length n-n/2. ;next i recursively call it on the b and c arrays and put the recursive results into two new arrays d and e, ;then i merge d and e and return it. ;the hardest part was figuring out how to do the recursive part. ;my solution does follow the o(nlogn) time requirement since it is using mergesort. ;however my solution i still could improve upon like fixing all the messy memory problems. ;i tested it the program with a large imput it and it works :)

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers