Question: Could you please help me in this questions please Question-1: Programming, Analysis and Criticize [10 Marks) Write a program to test the performance of Linear

Could you please help me in this questions please

Could you please help me in this questions please Question-1: Programming, Analysis

and Criticize [10 Marks) Write a program to test the performance of

Linear Search Vs Binary Search. Also, show the output after execution. The

Output will be varying for each student. (Hint: you can use System.nano

Time() to measure the time is taken to perform the linear search

and binary search on random numbers) Sample Output: For Size = 100

Question-1: Programming, Analysis and Criticize [10 Marks) Write a program to test the performance of Linear Search Vs Binary Search. Also, show the output after execution. The Output will be varying for each student. (Hint: you can use System.nano Time() to measure the time is taken to perform the linear search and binary search on random numbers) Sample Output: For Size = 100 Enter the key to be searched = 35 Time taken to search key using linear search: Key found in 6776 nanoseconds Time taken to search key using binary search: Key found in 8131 nanoseconds For Size = 1000 Enter the key to be searched = 650 Time taken to search key using linear search: Key found in 29815 nanoseconds Time taken to search key using binary search: Key found in 12649 nanoseconds For Size = 10000 Enter the key to be searched = 9845 Time taken to search key using linear search: Key found in 240325 nanoseconds Time taken to search key using binary search: Key found in 16714 nanoseconds For Size = 100000 Enter the key to be searched = 900 rime taken to search key using linear search: Key found in 134166 nanoseconds Time taken to search key using binary search: Key found in 19877 nanoseconds a. Do the program in eclipse, copy and paste the code here. [04.00] b. Criticize the design approach of Linear search vs Binary search [03.00] c. What is the time complexity of Linear search and Binary search average case. [01.00] d. Paste the output in the space provided, analyze the output, and explain which algorithm is faster. [02.00] 1. Translate this UML diagram into a Java interface [2.5 Marks] UML Java Interface Polynomial +degree(): int +derivative(): Polynomial +equals(p: Polynomial): boolean +sum(p: Polynomial): Polynomial +valueAt(r: Real): Real public interface Polynomial { public int degree(); public Polynomial derivative(); public boolean equals (Polynomial p); public Polynomial sum (Polynomial p); public Real valueAt (Real x); 1. The operation of visiting each element in the list is known as? a. Merging b. Traversal c. Sorting d. Inserting 2. How many comparisons are needed by binary search to search for an item in 1000 items a. 7 b. 30 c. 10 d. 14 3. Ordered arrays, compared with unordered arrays, are a. Quicker at deletion. b. Quicker at insertion. c. Quicker to create. d. Quicker at searching. 4. The average case time complexity of linear search is ? a. 0(1) b. o(log n) c. (n) d. o(n log n) 5. The average case time complexity of Binary search is ? b. 0(1) b. O(log n) c. O (n) d. O(n log n) 2. Study the below pseudo code and answer the following questions: i to while(i

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!