This preview shows pages 1–2. Sign up to view the full content.
CS 202 Fundamental Structures of Computer Science II
Assignment 1 – Algorithm Analysis, Sorting and Searching
Due Date: June 21, 2010
(Monday)
Question1 (30 points)
Trace the following sorting algorithm for sorting the array:
7 1 9 2 3 5
into ascending
order.
Use the array implementation as described in the textbook/lectures.
a)
Insertion sort.
b)
Selection sort.
c)
Bubble sort.
d)
Mergesort.
Also list the calls to
mergesort
and
merge
in the order in which they
occur.
e)
Quicksort. Also list the calls to
quicksort
and
partition
in the order in which
they occur. Assume that the first item is chosen as pivot.
Question2 (60 points)
– Programming Assignment
You are going to implement the following sorting algorithms for
linkedlists of integers
, and
empirically test them. First, write the methods for the following sorting algorithms for linked
lists of integers. Make sure that your methods sort the given linked lists of integers in
DESCENDING
order.
•
Insertion Sort
•
Quick Sort – selects the first item as pivot
•
Radix Sort
Then, write a main method to find the time requirements of your methods for different linked
lists of integers. You have to create 9 different linked lists and you have to find the time
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview. Sign up
to
access the rest of the document.
This note was uploaded on 12/01/2011 for the course CS 202 taught by Professor Amaşlm during the Spring '11 term at Bilkent University.
 Spring '11
 amaşlm
 Sort

Click to edit the document details