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

Exam 3 Review Sheet for Analysis of Algorithms | CSIS 385, Exams of Algorithms and Programming

Material Type: Exam; Class: Analysis of Algorithms; Subject: Computer Science; University: Siena College; Term: Unknown 1989;

Typology: Exams

Pre 2010

Uploaded on 08/09/2009

koofers-user-5dn
koofers-user-5dn 🇺🇸

5

(1)

10 documents

1 / 7

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CSIS-385: Exam 3 Review Sheet
List of Topics:
Graphs (5.1 - 5.3)
Adjacency List Implementation
Adjacency Matrix Implementation
Depth First Search (DFS) Decrease & Conquer
Breath First Search (BFS) Decrease & Conquer
Topological Sorting Decrease & Conquer
Trees (6.1 - 6.4)
Binary Search Trees (BST) Transform & Conquer
Balanced Binary Search Trees (AVL) Transform & Conquer
Single Rotation of AVL Trees Transform & Conquer
Double Rotation of AVL Trees Transform & Conquer
Heaps (6.4)
Making a heap (Top-down method) Transform & Conquer
Making a heap (Bottom-up method) Transform & Conquer
Heap insertion Transform & Conquer
Deleting Minimum & Restoring the heap Transform & Conquer
Heapsort Transform & Conquer
Hashing (7.1 & 7.3)
Bucketsort Special Topic
Radixsort Special Topic
Shortest Paths (8.2 & 9.3)
Floyd’s Algorithm Dynamic Programming
Dijkstra’s Algorithm Dynamic Programming
pf3
pf4
pf5

Partial preview of the text

Download Exam 3 Review Sheet for Analysis of Algorithms | CSIS 385 and more Exams Algorithms and Programming in PDF only on Docsity!

CSIS-385: Exam 3 Review Sheet

List of Topics: Graphs (5.1 - 5.3)  Adjacency List Implementation  Adjacency Matrix Implementation  Depth First Search (DFS) Decrease & Conquer  Breath First Search (BFS) Decrease & Conquer  Topological Sorting Decrease & Conquer Trees (6.1 - 6.4)  Binary Search Trees (BST) Transform & Conquer  Balanced Binary Search Trees (AVL) Transform & Conquer  Single Rotation of AVL Trees Transform & Conquer  Double Rotation of AVL Trees Transform & Conquer Heaps (6.4)  Making a heap (Top-down method) Transform & Conquer  Making a heap (Bottom-up method) Transform & Conquer  Heap insertion Transform & Conquer  Deleting Minimum & Restoring the heap Transform & Conquer  Heapsort Transform & Conquer Hashing (7.1 & 7.3)  Bucketsort Special Topic  Radixsort Special Topic Shortest Paths (8.2 & 9.3)  Floyd’s Algorithm Dynamic Programming  Dijkstra’s Algorithm Dynamic Programming

1. Given the following graph, a. Draw the adjacency list b. Draw the adjacency matrix c. Is the graph connected? Is there a path from ever vertex to every other vertex? 2. Given the following graph, a. Perform a DFS and draw the DFS tree b. Perform a BFS and draw the BFS tree

  1. Which algorithm DFS or BFS can find the minimum hop distance to any vertex in a graph? A B C D E F G H I 3 9 1 8 2 7 4 2 9 3 4 1 2 8 7 6 2 6 A B C D E F G H I 3 9 1 8 2 7 4 2 9 3 4 1 2 8 7 6 2 6

7. Given the following AVL tree, a. Show the result of inserting the value 45. Redraw the tree after inserting the value and performing the proper rotation if necessary. b. Show the result of inserting the value 75. Redraw the tree after inserting the value and performing the proper rotation if necessary. c. Given an AVL tree where the deepest node is at level 5, is it possible for another leaf node to be at level 3? (A leaf node has no children, the root is at level 1) 10 27 20 44 40 58 56 65 72 70 83 96 90 30 60 80 50

8. Given the following array, 0 1 2 3 4 5 6 7 38 72 12 46 96 50 23 84 a. Assume that value 72 and 12 are the left and right children of value 38, respectively and assume the pattern continues, i.e., 46 and 96 are the left and right child of 72. Given index i, write formulas for computing the parent of i, the left child of i and the right child of i. b. Use the bottom-up approach to store the data as a heap. Show the array after each parent node is percolated-down. c. Now, draw the final heap in part (b) as a tree, rather than an array. d. Insert the values 67 and 11 in the heap and show the final tree. 9. Given the following array, 0 1 2 3 4 5 6 7 96 34 78 23 28 60 52 22 a. Using the standard array implementation for a heap, do the values above satisfy the heap property. Is it a max heap? In no, move the values so that the array satisfies the max heap property. b. Remove the maximum value and restore the heap. c. Removing the maximum value requires replacing it with another value. The replacement value is always the last value in the array. Why? d. After replacing the maximum value with the last value in the array. The replacement value must be percolated-down. This operation takes O(log n) time since the heap could have O(log n) levels and the replacement value might have to be swapped to the lowest level. However, when we insert a value, we insert it at the lowest level. This inserted value could be percolated-up to the top level. How come insertions take O(1) time on average when deleting the maximum takes O(log n). In both cases, the value could be percolated up log n levels. Why is insertion O(1) on average.

**12. Given the following graph, show the adjacency matrix after each step of Floyd’s algorithm.

  1. Given the following graph, show the path table after each step of Dijsktra’s algorithm.** A B C D E F G H I 3 9 14 8 16 7 10 2 9 13 4 1 9 8 7 6 2 6 14 6 16 2 A B C D E F G H I 3 9 14 8 16 7 10 2 9 13 4 1 9 8 7 6 2 6 14 6 16 2