Testing item in array of member using sequential search

Assignment Help Data Structure & Algorithms
Reference no: EM1348844

1. Suppose you have an array of n items (the "member items") and a separate list of k items (the "test items"). The member items are not stored in any particular order. You want to know which of the k test items belong to the set of member items. Here are two di?erent ways to solve the problem:

Algorithm 1:

Look up each test item in the array of member items, using sequential search.

Algorithm 2: Sort the array of member items, using an optimal comparison-based sorting algorithm, and then look up each test item in the array of member items using binary search.

Answer the following questions, and brie?y justify your answer to each part.

(a) What is the worst-case running time of Algorithm 1 (asymptotically, in terms of n and k)?

(b) What is the worst-case running time of Algorithm 2 (asymptotically, in terms of n and k)?

(c) For a given value of n, for what values of k is Algorithm 2 at least as e?cient as Algorithm 1? (Express your answer using asymptotic notation, in terms of n).

Reference no: EM1348844

Questions Cloud

Self-control theory of criminality : A criticism of self-control theory is that as adults, it is already too late to instill levels of self-control that will inhibit criminality.
Calculate the temperature at the center of the cylinder : The resolution of the eye is ultimately limited by pupil diameter. What is the smallest diameter spot an eye can produce on the retina if pupil diameter is 4.45? Assume light with a wavelength of = 600 .
Illustrate amount of state income tax did red ball produce : Red Ball Production's taxable income in 2005 was $500,000. Illustrate what amount of state income tax did Red Ball Productions owe.
New expectations the ceo set with the vision : Stakeholders were jockeying for "position" to gain the CEO's favor rather than concentrating on the new programs and was no constructive way to handle the conflict situations that occurred. Training was clearly needed.
Testing item in array of member using sequential search : Look up each test item in array of member items, by using sequential search. What is the worst-case running time of it. (asymptotically, in terms of n and k)?
Expected rate of return : Starlight, corporation must choose between two asset purchases. The yearly rate of return and related probabilities given below summarize the firm's analysis.
Cultural differences in self-disclosure : Discuss the challenges that can exist in regards to cultural differences and self-disclosure. Include a minimum of one scholarly source to support your views.
Authority and power in business : Why is it important to maintain a balance of power between different groups of organizational stakeholders
Compute the critical path for the network : Enumerate all paths and their duration through this network and Compute the critical path for the network and What is the minimum duration of the project?

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Computing minimal length of key-average cracking time given

If Encrypt-It-Rite would like to increase average cracking time to at least 100 years, determine the minimal length of the key?

  Describe sorting algorithms and how they work

Describe sorting algorithms and how they work

  Explaining diffie-hellman public-key algorithm

Use the Diffie-Hellman public-key algorithm to exchange secret keys.

  Explain the fifo structure of the queue

Explain the FIFO structure of the queue Explain how you would implement the queue data structure in its simplest form. Illustrate your answer fully with the necessary sample code

  Computing time complexity of procedure

What is the time complexity of the procedure? If A[l .. r] = [24, 30, 09, 46, 15, 19, 29, 86,78], what is the output?

  C++ program to evaluate expressions combining set union

Create a C++ program to evaluate expressions combining set union, set intersection and parentheses

  What do you meant by an rfp

Select a specific category of vertical applications to investigate. Use the Internet and any other sources of information you might have to study some of the different products that are available in that category.

  Demonstrate a decision tree or table

Demonstrate a decision tree or table

  Computing total number of keys needed in symmetric cipher

Determine the total number of keys that are needed for organization if symmetric cipher is used.

  Use a search tree to find the solution

Explain how will use a search tree to find the solution.

  Primitives-remove ambiguities in algorithm-s representation

Describe how the use of primitives helps remove ambiguities in an algorithm's representation.

  Explain types of information systems

Question 1. Explain five types of information systems, and give an example of each. Question 2. Describe three common reasons for a systems request. Try and find one not listed in the text.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd