Question

consider lower bounds proofs on comparison based algorithms using decision trees. For each problem below, fill...

consider lower bounds proofs on comparison based algorithms using decision trees. For each problem below, fill in the table with:

-a. The number of possible answers to the problem
b. A lower bound based on the height of a decision tree for that problem. Simplify your answers.
c. Explain why you think it is (or not) possible to create an algorithm with the same order as the bound that you found.

Problem: 1- Search for the value X in an ordered array of size N

-a. The number of possible answers to the problem?

-b. A lower bound based on the height of a decision tree for that problem. Simplify your answers.?

-c. Explain why you think it is (or not) possible to create an algorithm with the same order as the bound that you found. ?

2- Search for the value X in an unordered array of size N

-a. The number of possible answers to the problem

-b. A lower bound based on the height of a decision tree for that problem. Simplify your answers.

-c. Explain why you think it is (or not) possible to create an algorithm with the same order as the bound that you found.

3- Sort an array of size N

-a. The number of possible answers to the problem

-b. A lower bound based on the height of a decision tree for that problem. Simplify your answers.

-c. Explain why you think it is (or not) possible to create an algorithm with the same order as the bound that you found.

4- Find the 1 st, 2nd and 3rd largest elements in an unordered array of size N

-a. The number of possible answers to the problem

-b. A lower bound based on the height of a decision tree for that problem. Simplify your answers.

-c. Explain why you think it is (or not) possible to create an algorithm with the same order as the bound that you found.

5- Find the shortest path in a fully-connected graph(with V vertices) that visits every vertex once and returns to the starting vertex.

-a. The number of possible answers to the problem

-b. A lower bound based on the height of a decision tree for that problem. Simplify your answers.

-c. Explain why you think it is (or not) possible to create an algorithm with the same order as the bound that you found.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

1. In this problem, the number of possible answers is as there are N indices at which X could be present in the array. Hence, any decision tree for this problem must have height at least , thus giving a lower bound. This can be achieved by running a binary search, as the array is ordered.

2. In this problem, the lower bound is the same as part 1. But it cannot be achieved, as in an unordered array, it takes at least N comparisons to find an element. This can be proven by as follows: If an algorithm doesn't look at each index, then there is some index which is not checked by the algorithm. Consider two array in which X is at that index, and another in which X is not. The answer of the algorithm cannot be different, while it should be. Hence, it needs time.

3. In sorting, from each permutation of the input, it must lead to the same output because as long as the values don't change, their sorted order is the same. Hence, the number of possible answers is . Thus the height of the decision tree must be . An algorithm can be devised with the same time complexity, as merge sort takes exactly this time.

4. Any answer will have three different indices, hence the number of answers is . Thus any decision tree must have height . This cannot be achieved, as to find the largest element in an unordered array, it must check all elements. This can be proven by an argument similar to 2.

5. If every vertex needs to visited once, then there are possible paths. Hence, the lower bound is again. This may not be achievable unless P=NP, as this problem is the travelling salesman problem, which is NP-complete.

Comment in case of any doubts.

Add a comment
Know the answer?
Add Answer to:
consider lower bounds proofs on comparison based algorithms using decision trees. For each problem below, fill...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Lower bound theory] Draw the decision tree for the comparison based sorting problem for four elements...

    Lower bound theory] Draw the decision tree for the comparison based sorting problem for four elements a1, a2, a3, a4 by starting your comparison between a1:a2. (Tips: (1) There will be 4!=24 different leafs in your tree.

  • Lower bound arguments. In class, we proved that any comparison-based algorithm that has to sort n...

    Lower bound arguments. In class, we proved that any comparison-based algorithm that has to sort n numbers runs in Ω (nlogn) time. Let’s change the problem a bit. Suppose S[1. . . n] is a sorted array. We want to know if S contains some element x. a. How would you solve this problem and what is the running time of your algorithm? (Note: you can just say what algorithm you will use.) b. Show that any comparison-based algorithm(i.e., one...

  • Data Mining: Explain why decision tree algorithm based on impurity measures such as entropy and Gini...

    Data Mining: Explain why decision tree algorithm based on impurity measures such as entropy and Gini index tends to favor attributes with larger number of distinct values. How would you overcome this problem?

  • Write a recurrence relation describing the worst case running time of each of the following algorithms,...

    Write a recurrence relation describing the worst case running time of each of the following algorithms, and determine the asymptotic complexity of the function defined by the recurrence relation. Justify your solution by using substitution or a recursion tree. You may NOT use the Master Theorem. Simplify your answers, expressing them in a form such as O(nk) or (nklog n) whenever possible. If the algorithm takes exponential time, then just give an exponential lower bound using the 2 notation. function...

  • 6. Consider the following basic problem. You're given an array A consisting of n integers A[1],...

    6. Consider the following basic problem. You're given an array A consisting of n integers A[1], A[2], , Aln]. You'd like to output a two-dimensional n-by-n array B in which B[i, j] (for i <j) contains the sum of array entries Ali] through Aj]-that is, the sum A[i] Ai 1]+ .. +Alj]. (The value of array entry B[i. Λ is left unspecified whenever i >j, so it doesn't matter what is output for these values.) Here's a simple algorithm to...

  • For each problems segment given below, do the following: Create an algorithm to solve the problem...

    For each problems segment given below, do the following: Create an algorithm to solve the problem Identify the factors that would influence the running time, and which can be known before the algorithm or code is executed. Assign names (such as n) to each factor. Identify the operations that must be counted. You need not count every statement separately. If a group of statements always executes together, treat the group as a single unit. If a method is called, and...

  • the two problems are related. Please explain your answer in full detail Problem 1: On input...

    the two problems are related. Please explain your answer in full detail Problem 1: On input a Binary Search Tree T show how to output an array that contains all the elements in T in sorted order. What's the running time of your algorithm? Does it perform any comparisons? Problem 2: Your classmate claims that they have an algorithm that on input n elements, constructs a Binary Search Tree T with those n elements using only O(n) comparisons. Can you...

  • Answer B java Problem 2 For each problem given below, do the following: 1. Create an...

    Answer B java Problem 2 For each problem given below, do the following: 1. Create an algorithm in pseudocode to solve the problem. 2.Identify the factors that would influence the running time of your algorithm. For example, if your algorithm is to search an array the factor that influences the running time is the array size. Assign names (such as n) to each factor. 3. Determine the number of operations in each step of the pseudocode. To do that, identify...

  • problem 2 can use Det-Selection(A, p, q, r) as a sub-routine (i.e, you don't need to...

    problem 2 can use Det-Selection(A, p, q, r) as a sub-routine (i.e, you don't need to write its pseudo-code). To sort an array A, you will then call Det-QuickSort(A, 1, n). You also need to provide the worst case time complexity analysis of your algorithm. 2. (20 points) Given a set of n distinct numbers, we wish to find the k largest in sorted order using a comparison-based algorithm. Give an algorithm that implements each of the following methods, and...

  • Searching/sorting tasks and efficiency analysis - Big-oh For each problem given below, do the following: 1....

    Searching/sorting tasks and efficiency analysis - Big-oh For each problem given below, do the following: 1. Create an algorithm in pseudocode to solve the problem. 2. Identify the factors that would influence the running time of your algorithm. For example, if your algorithm is to search an array the factor that influences the running time is the array size. Assign names (such as n) to each factor. 3. Count the operations performed by the algorithm. Express the count as a...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT