Docsity

CS 303L Data Structures and Algorithms Homework 1: Sorting Algorithms, Assignments of Computer Science

Toggle sidebar
bg1
CS 303L Data Structure and Algorithm
January 10, 2008
Homework 1
(Due on January 17, 2008)
Five commonly used sorting algorithms are listed below:
๏ƒ˜ Bubble sort
๏ƒ˜ Insertion sort
๏ƒ˜ Merge sort
๏ƒ˜ Quick sort
๏ƒ˜ Bucket sort
(1) Please give pseudo code for each algorithm.
(2) Please analyze the time complexity (in Big-Oh notation) of the above algorithms, and
answer the following two questions for each algorithm.
a. What is the time complexity of the average case?
b. What is the time complexity of the worst case?
(3) Please find those algorithms that their time complexity of average and worst case are
different.
(4) Please give example datasets to show average and worst case for those algorithms
found in (3).

Partial preview of the text

Download CS 303L Data Structures and Algorithms Homework 1: Sorting Algorithms and more Assignments Computer Science in PDF only on Docsity!

CS 303L Data Structure and Algorithm

January 10, 2008

Homework 1

(Due on January 17, 2008)

Five commonly used sorting algorithms are listed below:

๏ƒ˜ Bubble sort ๏ƒ˜ Insertion sort ๏ƒ˜ Merge sort ๏ƒ˜ Quick sort ๏ƒ˜ Bucket sort

(1) Please give pseudo code for each algorithm.

(2) Please analyze the time complexity (in Big-Oh notation) of the above algorithms, and answer the following two questions for each algorithm. a. What is the time complexity of the average case? b. What is the time complexity of the worst case?

(3) Please find those algorithms that their time complexity of average and worst case are different.

(4) Please give example datasets to show average and worst case for those algorithms found in (3).