Introduction to Algorithms
Introduction to Algorithms
3rd Edition
ISBN: 9780262033848
Author: Thomas H. Cormen, Ronald L. Rivest, Charles E. Leiserson, Clifford Stein
Publisher: MIT Press
Question
Book Icon
Chapter 21, Problem 1P

(a)

Program Plan Intro

To finds the correct values in the extracted array of sequence 4,8,E,3,E,9,2,6,E,E,E,1,7,E,5 for off-line minimum problem.

(a)

Expert Solution
Check Mark

Explanation of Solution

The EXTRACT-MIN algorithm is used to extract the minimum values from the cluster of number.

The INSERT algorithm is used to insert the value after the minimum value in the off-line minimum problem.

The algorithm takes the sequence of number and generates the corresponding values. The correct values in the extracted array are given in table below:

    INDEXVALUE
    14
    23
    32
    46
    58
    61

The algorithm picks the minimum from the sequence by considering the sequence and then it remove that value then add to the extracted array and the remaining keys are added to the old sequence by using insert algorithm.

(b)

Program Plan Intro

To argue the array extracted returned by OFF-LINE-MINIMUM is correct.

(b)

Expert Solution
Check Mark

Explanation of Solution

The OFF-LINE-MINIMUM algorithm find the minimum number from the available sequence by using the extract min and then it add the remaining number to the sequence using insert operation.

The algorithm pick the smallest element from the available element then removed it from the sequence then it checks that the extracted value is minimum or not and combine the set of elements that needs to inserted in the sequence that is remaining elements other than min is combined to the original sequence.

Every iteration of the algorithm is extracted the minimum one by one and added to the extracted array until the last is extracted and stored to the array.

Therefore, the output returns from the algorithm is correct and have finite sequence.

(c)

Program Plan Intro

To describe the implementation of OFF-LINE-MINIMUM algorithm for disjoint set data structure and also gives a tight bound of the implementation.

(c)

Expert Solution
Check Mark

Explanation of Solution

The algorithm pick the smallest element from the available element then removed it from the sequence then it checks that the extracted value is minimum or not and combine the set of elements that needs to inserted in the sequence that is remaining elements other than min is combined to the original sequence.

The implementation of the disjoint set of data structure through OFF-LINE-MINIMUM algorithm is given below:

Step 1: Select the disjoint sets.

Step 2: Check that l is the smallest value greater than j for Kl exists.

Step 3: Then add all the values of l for iterations of for loop into a linked list.

Step 4: Find the appropriate value of j using FIND-SET( i ).

Step 5: For every l there exist Kl so combine all the values of Kl with Kj and remove each l from the linked list whose Kl is already combined.

After removing l from the linked list it maintain the elements in O(1) time. The algorithm consists of for loop that runs n time and each time it takes constant amount of time that is O(n) .

For the every value of i the function finds the j using FIND-SET that takes times of total sequence, suppose the sequence need total η time to find the j having size n so it takes μ(n) time to find j .

Therefore, the total running time of the implementation of algorithm for disjoint set is O(nμ(n))

Want to see more full solutions like this?

Subscribe now to access step-by-step solutions to millions of textbook problems written by subject matter experts!
Students have asked these similar questions
The off-line minimum problem maintains a dynamic set T of elements from the domain {1, 2,...,n}under the operations INSERT and EXTRACT-MIN. A sequence S of n INSERT and m EXTRACT-MIN calls are given, where each key in {1, 2,...,n} is inserted exactly once. Let a sequence S berepresented by I1 , E, I2, E, ... , E, Im+1 , where each Ij stands for a subsequence (possibly empty) ofINSERT and each E stands for a single EXTRACT-MIN. Let Kj be the set of keys initially obtainedfrom insertions in Ij. The algorithm to build an array extracted[1..m], where for i = 1, 2, ..., m,extracted[i] is the key returned by the ith EXTRACT-MIN call is given below: Off-Line-Minimum(m, n)for i = 1 to n   determine j such that i ∈ Kj   if j ≠ m + 1      extracted[j] = i       let L be the smallest value greater than j for which KL exists      KL = KL U Kj, destoying Kjreturn extracted   Given the operation sequence 9, 4, E, 6, 2, E, E, 5, 8, E, 1, 7, E, E, 3; where eachnumber stands for its insertion.…
The off-line minimum problem maintains a dynamic set T of elements from the domain {1, 2,...,n}under the operations INSERT and EXTRACT-MIN. A sequence S of n INSERT and m EXTRACT-MIN calls are given, where each key in {1, 2,...,n} is inserted exactly once. Let a sequence S berepresented by I1 , E, I2, E, ... , E, Im+1 , where each Ij stands for a subsequence (possibly empty) ofINSERT and each E stands for a single EXTRACT-MIN. Let Kj be the set of keys initially obtainedfrom insertions in Ij. The algorithm to build an array extracted[1..m], where for i = 1, 2, ..., m,extracted[i] is the key returned by the ith EXTRACT-MIN call is given below: Off-Line-Minimum(m, n)for i = 1 to n   determine j such that i ∈ ??   if j ≠ m + 1      extracted[j] = i       let L be the smallest value greater than j for which KL exists      KL = KL U Kj, destroying ????return extracted (1) Given the operation sequence 9, 4, E, 6, 2, E, E, 5, 8, E, 1, 7, E, E, 3; where eachnumber stands for its…
The off-line minimum problem maintains a dynamic set T of elements from the domain {1, 2,...,n}under the operations INSERT and EXTRACT-MIN. A sequence S of n INSERT and m EXTRACT-MIN calls are given, where each key in {1, 2,...,n} is inserted exactly once. Let a sequence S berepresented by I1 , E, I2, E, ... , E, Im+1 , where each Ij stands for a subsequence (possibly empty) ofINSERT and each E stands for a single EXTRACT-MIN. Let Kj be the set of keys initially obtainedfrom insertions in Ij. The algorithm to build an array extracted[1..m], where for i = 1, 2, ..., m,extracted[i] is the key returned by the ith EXTRACT-MIN call is given below: Off-Line-Minimum(m, n)for i = 1 to n   determine j such that i ∈ Kj   if j ≠ m + 1      extracted[j] = i       let L be the smallest value greater than j for which KL exists      KL = KL U Kj, destoying Kjreturn extracted   Given the operation sequence 9, 4, E, 6, 2, E, E, 5, 8, E, 1, 7, E, E, 3; where eachnumber stands for its insertion.…
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education