Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 1 12.5 pts Select the best answer from each dropdown menu. Examine this algorithm. Given a sequence A and an element e, this algorithm

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Question 1 12.5 pts Select the best answer from each dropdown menu. Examine this algorithm. Given a sequence A and an element e, this algorithm returns the smallest index of e in Sequence A if A contains e. If A does not contain e, this algorithm returns - 1. find-Element(e, A) index = 1 while ((index A.length) index = -1 return(index) Given this problem instance with an n-items sequence and a number e. In the worst case, the number of comparisons for this algorithm will grow a v [Select ] 1/2 n^2 None of these answers n In(n) Question 2 12.5 pts Select the best answer from each dropdown menu. Examine this algorithm. Given a sequence A and an element e, this algorithm returns the smallest index of e in Sequence A if A contains e. If A does not contain e, this algorithm returns -1. find-Element(e,A) index = 1 while ((index A. length) index = -1 return(index) Given this problem instance with an n-items sequence and a number e. In the average case, the number of comparisons for this algorithm will grow a v [Select] None of these answers n/2 n^2 n+1 Question 3 12.5 pts Select the best answer from each dropdown menu. Examine this algorithm. Given a sequence A and an element e, this algorithm returns the smallest index of e in Sequence A if A contains e. If A does not contain e, this algorithm returns -1. find-Element(e,A) index = 1 while ((index = A.length) and (A[index]= e)) index = index + 1 if (index > A.length) index = -1 return(index) Given this problem instance [e=54, A=(3, 7,54, 2, 100, 2, 45)], this algorithm will execute [ Select] comparisons and will return [Select] Question 4 12.5 pts Select the best answer from each dropdown menu. Examine this algorithm. Given a sequence A and an element e, this algorithm returns the smallest index of e in Sequence A if A contains e. If A does not contain e, this algorithm returns -1. find-Element(e,A) index = 1 while ((index A.length) index = -1 return(index) Given this problem instance with an n-items sequence and a number e. In the best case, the number of comparisons for this algorithm will grow as (Select] Question 5 12.5 pts Select the best answer from each dropdown menu. Examine this algorithm. Given a sequence A and an element e, this algorithm returns the smallest index of e in Sequence A if A contains e. If A does not contain e, this algorithm returns -1. find-Element(e,A) index = 1 while ((index A.length) index = -1 return(index) Given this problem instance [e=3, A=(3, 7, 54, 2, 100, 2, 45)], this algorithm will execute [ Select] comparisons and will return [Select] Question 6 12.5 pts Select the best answer from each dropdown menu. Examine this algorithm. Given a sequence A and an element e, this algorithm returns the smallest index of e in Sequence A if A contains e. If A does not contain e, this algorithm returns - 1. find-Element(e,A) index = 1 while ((index = A.Length) and (A[index]z e)) index = index + 1 if (index > A.length) index = -1 return(index) Given this problem instance with an n-items sequence and a number e. This algorithm will perform [Select] comparisons. Question 7 12.5 pts Select the best answer from each dropdown menu. Examine this algorithm. Given a sequence A and an element e, this algorithm returns the largest index of e in Sequence A if A contains e. If A does not contain e, this algorithm returns - 1. find-Element(e, A) index = A.length while ((index > 0) and (A[index]z e)) index = index - 1 if (index A.length) index = -1 return(index) Given this problem instance with an n-items sequence and a number e. This algorithm will perform on average [Select] - comparisons

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

Students also viewed these Databases questions

Question

Comment should this MNE have a global LGBT policy? Why/ why not?

Answered: 1 week ago