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

  Implement an open hash table

In this programming assignment you will implement an open hash table and compare the performance of four hash functions using various prime table sizes.

  Use a search tree to find the solution

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

  How to access virtualised applications through unicore

How to access virtualised applications through UNICORE

  Recursive tree algorithms

Write a recursive function to determine if a binary tree is a binary search tree.

  Determine the mean salary as well as the number of salaries

Determine the mean salary as well as the number of salaries.

  Currency conversion development

Currency Conversion Development

  Cloud computing assignment

WSDL service that receives a request for a stock market quote and returns the quote

  Design a gui and implement tic tac toe game in java

Design a GUI and implement Tic Tac Toe game in java

  Recursive implementation of euclids algorithm

Write a recursive implementation of Euclid's algorithm for finding the greatest common divisor (GCD) of two integers

  Data structures for a single algorithm

Data structures for a single algorithm

  Write the selection sort algorithm

Write the selection sort algorithm

  Design of sample and hold amplifiers for 100 msps by using n

The report is divided into four main parts. The introduction about sample, hold amplifier and design, bootstrap switch design followed by simulation results.

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