Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(Grading details: correct answer=10, empty=0, wrong answer=-5) Consider the problem of finding maximum and minimum elements in a list by a comparison-based algorithm. Remember the

image text in transcribed

(Grading details: correct answer=10, empty=0, wrong answer=-5) Consider the problem of finding maximum and minimum elements in a list by a comparison-based algorithm. Remember the lower bound analysis of this problem with the adversary technique we covered in the lectures (where we made use of the lists U. W. L WL). This question is about visualization of this analysis on an example. Suppose that there is an algorithm for solving this problem. Given an input list L=[10,20,30,40,50], the algorithm makes the following comparisons in this order: compares 40 and 50 compares 30 and 50 compares 30 and 40 compares 10 and 40 compares 20 and 30 In the answers below, each line shows the contents of the lists after each comparison. That is the first line shows the lists after the first comparison, etc. Which one of the following is a possible configuration when we take into account the interventions of the adversary? Select one: U= [10 20 30). W = [50]. 1.- [40], WL = [] U= [10 20). W = [50]. L = [30 403, WL-U U = [10 20). W-145 50), L - [40], WL- U = [20], W=[45 50), L-[10], WL - [40] Oa. U = 11. W = [30 45 50). 1. - [10 20). WI. - [40] U= [10 20 30). W = 150), L - (40), WL = 11 U = [10 20). W = (50), L = [30 40), WL=0 U-[10 20], W-[40 50), L - [30], WL-O U-120], W = [40 50), L = 110 30), WI - IL Ob. U= []. W = [30 40 50), L = [10 20). WL = [] U = [10 20 30). W = (50), L = [40], WL=0 U = [10 20). W - [30], L (30 40), WL=0 U = [10 20), W-[50]. L - [30], WL - [40] U - [20]. W = [50]. L- [10 301, WL - [40] . U=0. WE [35 50), L = 1030), WL = [40] U=[10 20 30), W - [50]. L- [40], WL = 0 U = [10 20). W = [50], L - [3040], WL-U U-[10 20), W-[50]. L-[30]. WL - [40] U = [20]. W = [50]. L = [10 30], WL = [40] Od U=1). W-[50]. L = [10 20). WL = [3040]

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

Database Management With Website Development Applications

Authors: Greg Riccardi

1st Edition

0201743876, 978-0201743876

More Books

Students also viewed these Databases questions

Question

What is Aufbau's rule explain with example?

Answered: 1 week ago

Question

Write Hund's rule?

Answered: 1 week ago