Uncategorized

Data Structures and Algorithms

CSAS 2126 Data Structures and Algorithms
Priority Queues, Tree, and Disjoint Sets
Questions
1. Priority queue [20 points] Complete the exercise from textbook 6.18 (page 285)
2. Tree [10 points] Complete the exercise from textbook 4.15 (page 184)
3. Disjoint Sets [20 points] Consider the set of vertices A-P, and the relationships {(D, A), (B, E), (C, P), (I, J), (L, N), (O, D), (K, L), (L, A), (F, M), (G, M), (H, P), (L, G), (E, K)}. Show the final
forest if
a) The tree for the right element is always pointed at the left element.
b) The smaller tree is always pointed at the larger tree, pointing right at left if of equal rank.
c) The smaller tree is always pointed at the larger tree, and path compression is used.
In each case, give the total number of pointers followed in searching and the number of pointers added or changed during the algorithm. Then, for each
forest, give (1) the maximum depth of a node, and (2) the cost of searching, averaged over the 16 nodes. [Remember that a search starts at the node and
runs to the root. Do not use path compression on those searches.] Instructions
• For all the questions, either you can write a clear pseudocode/Algorithm or C++ programming language.
• There are 3 questions and try to complete the first 2. For problem statement 3 –after the Monday session (April 11’ 2022), you can start doing the
assignment
CSAS 2126 Data Structures and Algorithms
Priority Queues, Tree, and Disjoint Sets
Questions
1. Priority queue [20 points] Complete the exercise from textbook 6.18 (page 285)
2. Tree [10 points] Complete the exercise from textbook 4.15 (page 184)
3. Disjoint Sets [20 points] Consider the set of vertices A-P, and the relationships {(D, A), (B, E), (C, P), (I, J), (L, N), (O, D), (K, L), (L, A), (F, M), (G, M), (H, P), (L, G), (E, K)}. Show the final
forest if
a) The tree for the right element is always pointed at the left element.
b) The smaller tree is always pointed at the larger tree, pointing right at left if of equal rank.
c) The smaller tree is always pointed at the larger tree, and path compression is used.
In each case, give the total number of pointers followed in searching and the number of pointers added or changed during the algorithm. Then, for each
forest, give (1) the maximum depth of a node, and (2) the cost of searching, averaged over the 16 nodes. [Remember that a search starts at the node and
runs to the root. Do not use path compression on those searches.] Instructions
• For all the questions, either you can write a clear pseudocode/Algorithm or C++ programming language.
• There are 3 questions and try to complete the first 2. For problem statement 3 –after the Monday session (April 11’ 2022), you can start doing the
assignment

Essay Mill

Share
Published by
Essay Mill

Recent Posts

Childbirth

For this short paper activity, you will learn about the three delays model, which explains…

3 weeks ago

Literature

 This is a short essay that compares a common theme or motif in two works…

3 weeks ago

Hospital Adult Medical Surgical Collaboration Area

Topic : Hospital adult medical surgical collaboration area a. Current Menu Analysis (5 points/5%) Analyze…

3 weeks ago

Predictive and Qualitative Analysis Report

As a sales manager, you will use statistical methods to support actionable business decisions for Pastas R Us,…

3 weeks ago

Business Intelligence

Read the business intelligence articles: Getting to Know the World of Business Intelligence Business intelligence…

3 weeks ago

Alcohol Abuse

The behaviors of a population can put it at risk for specific health conditions. Studies…

3 weeks ago