Concept explainers
(a)
To prove that exactly
(a)
Explanation of Solution
The input array has distinct elements and each element is equally likely so the distribution is uniformly supported on the array.
As the array has n elements then the probability of each element occurs as
Since, there are distinct n elements so thepermutation of the leaf nodes is exactly
(b)
To shows
(b)
Explanation of Solution
Suppose the tree T then the depth of particular elements of LT is one less than the depth of the tree so the
Since the minimum length of the left leaf and the minimum length of the right leaf are equals to the length of the tree there is another variable k which defines the constant increasing in the path defined in the minimum path of the length.
Therefore,
(c)
To show that
(c)
Explanation of Solution
Suppose a tree T having leaves node k, LT and RT be minimum length path of left and right leaves then the equation of the tree is defined as follows:
Suppose the minimum path length equation of the tree as follows:
Now, suppose the LT have
For the minimum external path length the value of the equation is consider as minimum value of the i value of the
(d)
To show that the function
(d)
Explanation of Solution
Suppose i is a continuous variable and it finds the critical points using derivatives of the tree equation
Suppose it picks the two sub-trees of approx. equal sizes then the depth of the tree is equals to
Suppose the tree equation
Taking the log on both sides with derivate of the equation.
Putting the value
As
Therefore, the equation
(e)
To show that
(e)
Explanation of Solution
Suppose that a tree with k leaves needs to have external length
The average-case is the situation in which the
Since the average-case run time is the depth of a leaf weighted by the probability of that leaf being the one that occurs.
Therefore, the running time is
(f)
To show that for any randomized comparison sort B , there is a deterministic comparison sort A whose expected number of comparisons is no more than those made by B .
(f)
Explanation of Solution
The expected running time is the average over all possible results from the random bits. The equation of the tree is defined as follows:
The comparisons sort of B has the randomness that has higher value than the deterministic comparisons of A. The random sorting algorithm uses the partition of the array and uses the random sorting values for the dividing the array.
The possible fixing of the randomness resulted in a higher runtime, the average would have to be higher than the other so comparisons sort of B has higher value.
Want to see more full solutions like this?
Chapter 8 Solutions
Introduction to Algorithms
- Please solve this question in machine learning quicklyarrow_forwardAlgorithm for LLP-GAN training algorithmInput: The training set L = {(Bi, pi)}n i=1; L: number of total iterations; λ: weight parameter.Input: The parameters of the final discriminator D.Set m to the total number of training data pointsarrow_forwardGiven an undirected weighted graph G with n nodes and m edges, and we have used Prim’s algorithm to construct a minimum spanning tree T. Suppose the weight of one of the tree edge ((u, v) ∈ T) is changed from w to w′, design an algorithm to verify whether T is still a minimum spanning tree. Your algorithm should run in O(m) time, and explain why your algorithm is correct. You can assume all the weights are distinct. (Hint: When an edge is removed, nodes of T will break into two groups. Which edge should we choose in the cut of these two groups?)arrow_forward
- make Membership Testing AlgorithmInput: a group G operating on f = 1,2,.....n; a permutation g of f = 1,2,.....n; a base and strong enerating set for G; Schreier vectors v I 1 I k, for the stabiliser chainOutput: a boolean result showing if g G is in the group; function is in group(p: permutation; I 1..k+l): boolean; (* return true if the permutation p is in the group G I *)arrow_forwardCreative Reductions 11-22. Prove that the following problem is NP-hard: Problem: Hitting Set Input: A collection C of subsets of a set S, positive integer k. Output: Does S contain a subset S' such that |S'| < k and each subset in C contains at least one element from S'?arrow_forwardLet V be an array containing n distinct integer elements. Suppose there is an algorithm that needs to find a pair of elements from V such that the sum of the elements is equal to k. We may assume that the algorithm always finds such a pair. Explain using the number of leaf nodes in a decision tree why the algorithm must take omega(log n) worst case time.arrow_forward
- Given a sorted list L of n numbers in non- decreasing order and also a number x, the search problem is to determine whether x is in L or not. Use the decision tree method to prove that any comparison-based algorithm needs to perform at least Llog2n] comparisons for solving the search problem.arrow_forwardTrue/False. Give a short explanation. i. Let T be a tree constructed by Dijkstra's algorithm for a weighted connected graph G. T is a spanning tree of G? ii. Let T be a tree constructed by Dijkstra's algorithm for a weighted connected graph G. T is a minimum spanning tree of G? iii. If an NP-complete problem can be solved in linear time, then all NP-complete problems can be solved in linear time. iv. If P # NP, there could be a polynomial-time algorithm for SAT.arrow_forwardLet G = (V, E) be a DAG, where every edge e = ij and every vertex x have positive weighs w(i,j) and w(x), respectively, associated with them. Design an algorithm for computing a maximum weight path. What is the time complexity of your algorithm? (You must start with the correct definitions, and then write a recurrence relation.)arrow_forward
- For the algorthim write a recurrence for its runtime, use the recurrence tree method to solve the recurrence, and and find the tightest asymptotic upper bound on the runtime of the algorthim. Algorthim Problem: Algorithm H divides an instance of size n into 4 subproblems of size n/3 each, recursively solves each one, and then takes O(n^2) time to combine the solutions and output the answer.arrow_forwardConsider the recurrence T(n). r(n) = { T[{\√~]) + d if n ≤ 4 ([√n])+d_ifn>4 Use the recursion tree technique or repeated substitution to come up with a good guess of a tight bound on this recurrence and then prove your tight bound correct with induction or another technique.arrow_forwardFor the algorthim write a recurrence for its runtime, use the recurrence tree method to solve the recurrence, and and find the tightest asymptotic upper bound on the runtime of the algorthim. Algorrthim Problem: Algorithm V divides an instance of size n into 6 subproblems of size n/6 each, recursively solves each one, and then takes O(n) time to combine the solutions and output the answer.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