Docsity

Advanced Data Structures and Algorithms, Exams of Data Structures and Algorithms

Toggle sidebar
bg1
Advanced Data Structures
and Algorithms - Test 2
Review
A DAG is - ANSa digraph with no directed cycles
A hash function is - ANSany function that can be used to map data of
arbitrary size to fixed-size values
A hash table is - ANSa table for implementing the dictionary operations
where a hash function is used to compute an index
A sink in a DAG is a - ANSvertex v such that all the edges at v are directed
into v
A source in a DAG is a - ANSvertex v such that all the edges at v are directed
out of v
A topological sort labeling of a DAG is a labeling of the vertices such that -
ANSthe label of the tail of every edge is smaller than the label of its head
A topological sort of a DAG always yields - ANSthe reverse explored order of
a DFT
A topological sort of a DAG is a - ANSlist of the vertices so that for each edge
(u, v) vertex u occurs before vertex v in the list
pf3
pf4
pf5

Partial preview of the text

Download Advanced Data Structures and Algorithms and more Exams Data Structures and Algorithms in PDF only on Docsity!

Advanced Data Structures

and Algorithms - Test 2

Review

A DAG is - ANSa digraph with no directed cycles A hash function is - ANSany function that can be used to map data of arbitrary size to fixed-size values A hash table is - ANSa table for implementing the dictionary operations where a hash function is used to compute an index A sink in a DAG is a - ANSvertex v such that all the edges at v are directed into v A source in a DAG is a - ANSvertex v such that all the edges at v are directed out of v A topological sort labeling of a DAG is a labeling of the vertices such that - ANSthe label of the tail of every edge is smaller than the label of its head A topological sort of a DAG always yields - ANSthe reverse explored order of a DFT A topological sort of a DAG is a - ANSlist of the vertices so that for each edge (u, v) vertex u occurs before vertex v in the list

An effective way to prove correctness of the greedy method for solving the knapsack problem is to use - ANSproof by contradiction An efficient way to test for cycles when implementing Kruskal's algorithm is to utilize: - ANSDisjoint sets ADT where the collection of disjoint sets corresponds to the vertex sets of the trees in the forest being grown. Consider symbols a, b, c, d, e with frequencies 10, 20, 30, 40, 50 respectively. The length of the Huffman code for symbols a, b, c, d, e is respectively - ANS3, 3, 2, 2, 2 Consider the recurrence relation given by W(n) = 10W(n/2), initial condition W(1) = 1 for n a power of 2. Then W(n) has order: - ANSn^(log2(10)) DAG stands for - ANSdirected acyclic graph Dijkstra's algorithm can be implemented efficiently using - ANSa priority queue of vertices not in the current tree T where the priority of a vertex is Dist[v] Dijkstra's algorithm for finding shortest paths from vertex r to all the other vertices (if such a path exists) in a diagraph where edge e is assigned the positive real weight w(e) is based on: - ANSGrowing a tree T rooted at r by adding the smallest-weight edge in Cut(T), where the weight of an edge xy in Cut(T) is Dist[x] + w(xy). Dijkstra's shortest-path algorithm is similar to - ANSPrim's MST algorithm FFT has order worst-case complexity W(n) given by: - ANSnlog(n)

The knapsack problem is solved using the greedy method by first - ANSsorting the objects in nonincreasing order of their identities The number of multiplications performed by Strassen's algorithm to compute the product of two nxn matrices: - ANSn^(log2(7)) The number of spanning tress of Ksub10 is - ANS100,000, The order of the worst-case complexity of Kruskal's MST algorithm for a graph having n vertices and m edges, implemented using adjacency lists, is:

  • ANSmlog(n) The recurrence relation for the worst-case complexity W(n) of Strassen's algorithm is given by - ANSW(n) = 7W(n/2), W(1) = 1 To prove that a (finite) DAG contains a sink vertex - ANSStart at any vertex and keeping growing a directed path until a sink is reached Two primitive 4th roots of unity are - ANSi and -i Two standard techniques for resolving collision in hashing are - ANSchaining and open addressing What is the order worst-case complexity of Prim's MST algorithm when the graph G on n vertices is implemented using it adjacency matrix? - ANSn^ What is the worst-case complexity of Dijkstra's algorithm when the graph G on n vertices and m edges is implemented using its adjacency matrix and an

array is used to implement the priority queue of vertices not in the current tree? - ANSn^