Problem 6: Disjoint sets. Let operations Union() and Find-Set() be efficient: that
means sets are implemented by trees, the name of the new set is always the name of the
deepest set, and when finding a representative of the set employs the path compression on
its way up.
(i) On the set of disjoint sets {{1}, {2}, . . . , {10}} we perform the following sequence of
operations:
Union(1, 3), Union(4, 5), Union(6, 1), Union(6, 3), Union(7, 8), Union(10, 9),
Union(3, 10), Find-Set(2), Find-Set(10), Find-Set(9) and Find-Set(8).
Draw your data structure after the last Union() operation and after each of the
Find-Set() operations.
(ii) On the set of disjoint sets {{1}, {2}, . . . , {n}} perform n − 1 Union() operations
such that the first Find-Set() operation will be as slow as possible. Write down the
sequence of Union() operations and the element of the first Find-Set() operation.
Elaborate.
Hint: How slow the operation Find-Set() can be
Step by stepSolved in 3 steps
- The book demonstrated that a poisoned reverse will prevent the count-to-infinity problem caused when there is a loop involving three directly connected nodes. However, other loops are possible. Will the poisoned reverse solve the general case count-to-infinity problem encountered by Bellman-Ford? -Yes, the poisoned reverse will prevent a node from offering a path that includes preceding nodes in the loop. -It will not, preceeding nodes may still be used in the computation of the distance vector offered by a given node.arrow_forwarda.Given the steps of Kruskal’s algorithm, analyze each loop and find its running time cost in terms of V and E. MST-KRUSKAL(G,w) A ← for each vertex v V MAKE-SET(v) sort E into non-decreasing order by w for each (u, v) taken from the sorted list if FIND-SET(u) FIND-SET(v) then A ← A {(u, v)} UNION(u, v) return A b. What is the total asymptotic running time of Kruskal’s algorithmarrow_forwardInterchange Base Points AlgorithmOutput: a base B = [131,132..... 13j-1, 13L.+1, 13j, 13j+2, 13j+3..... 13k] for G; a strong generating set relative to B; procedure interchange(var B: sequence of points; vat S: set of elements; j: 1..k-1);Interchange Base Points AlgorithmInput: a group G; a base [131,132..... 13k] for G and a strong generating set; an integer j between 1 and k-l; Output: a base [131,132..... 13k] for G and a strong generating set.arrow_forward
- Take into account the usage of the i-accepting OrderedStructure get function. This technique returns the OrderedStructure's ith element.What are this technique's ideal and ideal-worst execution times on OrderedVector and OrderedList?arrow_forwardProblem 3. Given a node in a binary search tree, its successor is the successor node in the sorted order determined by an inorder tree traversal. Use pseudo codes to write a function BST-Successor, which returns the successor node of a given node in a BST. You may assume that all the BST regular operation functions are existed and can be used for your function.arrow_forwardOn S = f2; 4; 6; 10; 12; 20; 30; 60g we work with the divisibility relation R:xRy , x divides y:(i) Draw the Hasse diagram of R.(ii) Find all R-minimal elements.(iii) Find all R-maximal elements.(iv) Find all non-empty subsets U S, so that 6 is an R-lowerbound of U.(v) Let A = f6; 10; 12g. If A admits an R-supremum, nd it. If A admits an R-in mum, nd it.(vi) Is R a lattice?arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education