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

  Find the minimum cost path from a designated node

Find the Minimum Cost Path from a designated start node to a designated destination node in a graph.

  Determine the inorder, preorder and postorder traversal

Determine the Inorder, preorder and postorder traversal

  Algorithm to concatenate string in single binary search tree

Create algorithm which concatenates T1 and T2 into single binary search tree. Worst case running time must be O(h).

  Different applications of data structure

What are the different applications of Data Structure

  Explaining playout delay algorithm

Let the adaptive playout delay algorithm. Show through simple example that adjusting playout delay at beginning of each talk.

  Steps of asymmetric encryption algorithms to read message

Using only asymmetric encryption algorithms write down any steps taken by Bob which permit him to read the message.

  Decrypting the ciphertext to recover the plaintext

If you get ciphertext message YPHDCRPBEQTAA, decrypt to recover plaintext.

  Creating financial tracking program

Acme Inc. is making next generation financial tracking program, and Alice has been provided the task of writing encryption component.

  Algorithm to minimize average difference between height

The problem is to assign each skier a ski to minimize the average difference between height of a skier and his/her ski. Give pseudocode and write its asymptotic running time.

  Transmitting image using raster scan order

If we were to transmit this image using raster scan order, after 15 seconds how many rows of the image will the user have received?

  Write down the algorithm to insert an item

Write down the sample code to create a Linked List and allocate storage space for a node Write down the algorithm to insert an item At the beginning of a linked list

  Write the selection sort algorithm

Write the selection sort algorithm

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