Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Analysis of Algorithms - Final Exam 2003 | CS 404, Exams of Algorithms and Programming

Material Type: Exam; Class: Analysis Of Algorithms; Subject: Computer Science; University: Northeastern Illinois University; Term: Fall 2003;

Typology: Exams

2009/2010

Uploaded on 02/24/2010

koofers-user-ty9
koofers-user-ty9 🇺🇸

10 documents

1 / 6

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS 404-31 - Analysis of Algorithms
Final Exam
December 3, 2003
1. Use Binary Search Recursion to search for the integer 26 in the following list of integers.
Show the actions step by step.
15 26 39 41 44 50 55 60
2. Suppose that there are n= 2kteams in an elimination tournament, in which there are
n/2 games in the first round, with the n/2 = 2k1winners playing in the second round
and so on.
(a) Develop a recurrence equation for the number of rounds in the tournament
(b) How many rounds are there in the tournament when there are 256 teams?
(c) Solve the recurrence equation of part (a).
pf3
pf4
pf5

Partial preview of the text

Download Analysis of Algorithms - Final Exam 2003 | CS 404 and more Exams Algorithms and Programming in PDF only on Docsity!

CS 404-31 - Analysis of Algorithms Final Exam December 3, 2003

  1. Use Binary Search Recursion to search for the integer 26 in the following list of integers. Show the actions step by step.

15 26 39 41 44 50 55 60

  1. Suppose that there are n = 2k^ teams in an elimination tournament, in which there are n/2 games in the first round, with the n/2 = 2k−^1 winners playing in the second round and so on.

(a) Develop a recurrence equation for the number of rounds in the tournament (b) How many rounds are there in the tournament when there are 256 teams? (c) Solve the recurrence equation of part (a).

  1. Sort the following list showing the actions step by step, by using

(a) Mergesort (b) Quicksort

252 176 315 121 343 276 122 305

  1. Write an algorithm that prints out all the subsets of four elements of a set of n elements. The elements of this set are stored in a list that is the input to the algorithm. Define its basic operations and study its performance. Is that performance an every-case time complexity? Otherwise determine the worst-case complexity.
  1. Find the minimum spanning tree for the following graph using:

(a) Prim’s Algorithm (b) Kruskal’s Algorithm

3

V

V4 V

V

V

2

3

6 5

4

1

  1. Use Dijkstra’s Algorithm to find the shortest path to all vertices from vertex v 4
  1. Can you show a solution for the 4-queens problem where the queen on the first row is NOT placed on the second column? Show all your work.
  2. Use the backtracking algorithm for the Sum-of-Subsets problem to find all combinations of the following numbers that sum to W = 52:

w 1 = 2 w 2 = 10 w 3 = 13 w 4 = 17 w 5 = 22 w 6 = 42