Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Give pseudocode of a comparison-based algorithm that outputs the maximum of four integers x1, x2, x3, x4. 2. Draw the decision tree of the

1. Give pseudocode of a comparison-based algorithm that outputs the maximum of four integers x1, x2, x3, x4.

2. Draw the decision tree of the algorithm in the style of below, clearly labeling i)each internal node with the comparison ("

image text in transcribed

algorithm Proof: The running time of a comparison-based sorting alg greater than or equal to the height of the decision tree T associated witust gorithm, as described above. (See Figure 8.12.) By the above argume this external node in T must be associated with one permutatico permutation of S must result in a different external node ofT permutations of n objects is ritho decision treo must b with this a above argument, each . The numbees, Thus, T must have at least nl external nodes. By Theorem 2.7, the height of T at least log(n!). This immediately justifies the theorem, because there are at t /2 terms that are greater than or equal to n/2 in the product n!; hence east log(n!) 2 log (3) = 2 log n which is ?(n log n) minimum height (time) x

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction To Data Mining

Authors: Pang Ning Tan, Michael Steinbach, Vipin Kumar

1st Edition

321321367, 978-0321321367

More Books

Students also viewed these Databases questions

Question

explain what is greenwashing? (not Futerra's guide)

Answered: 1 week ago