cse310-sum10-a02

cse310-sum10-a02 - CSE 310: Algorithms and Data Structures...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CSE 310: Algorithms and Data Structures Assignment 2: Recursion and Running Time (Due Date: June 21, 2010) 1. Write a recursive and iterative program for insertion sort 2. Write a recursive and iterative program for selection sort 3. Write a recursive and iterative program for merge sort 4. Plot the runtimes of all the 6 sorting algorithms for n=10, 100, 1000, 10,000, 100,000, and 1000,000 Initialize the array to be sorted randomly at the beginning of the program, and only include the time to sort for the runtime of the program. Make sure that you are not running anything else on your computer; otherwise, the times will not be accurate. You can use the time function in C/C++ to calculate the execution time. E.g., time_t t1=time(NULL); do_something_long(); time_t t2=time(NULL); printf("%d seconds elapsed\n", t2‐t1); ...
View Full Document

Ask a homework question - tutors are online