Using big-o notation state the runtime for this algorithm

Assignment Help Data Structure & Algorithms
Reference no: EM13582321

1) Consider searching algorithms on the following array of data:

 

[22 ,21 ,9, 4 ,16, 2 ,10, 14 ,20 ,31 ,26 ,19 ,17, 28 ,8 ,13]

 

Suppose you want to implement a searching algorithm to see if the data set contains the number 19.

 

(a) Demonstrate (with diagrams like the ones I show in the live chats and in the Phase 5 PowerPoint Guide) how the search would go if you used:

 

  •  
    • A sequential search
    • A binary search

 

(b) State the runtime for each of the searches, in this example, and for general data sets of size n. (and how you reached this run time)

 

(c) Address the issue of the order of the data in binary searching.

 

2) Suppose an algorithm that processes a data set of size 8 has a runtime of 72, and the same algorithm on a data set of size 20 has a runtime of 420.

 

 - Using big-O notation, state the runtime for this algorithm for the general case of a data set of size n. Show your work.

 

3) Suppose you develop an algorithm that processes the first element of an array (length of n), then processes the first 2 elements, then the first 3 elements, and so on, until the last iteration of a loop, when it processes all elements. Thus, if n = 4, the runtime would be 1 + 2 + 3 + 4 = 10.

 

  •  
    • Create a table that depicts the runtime for arrays of length 1 to n. Would you expect the general runtime to be O(n), O(n2), O(n3), or some other function of n? Explain.

 

Reference no: EM13582321

Questions Cloud

State the union and intersection of the 2 sets and the : part i demonstrate demorgans laws using a venn diagram. define 2 sets and a universal set within which the 2 sets
Assume that a firm with a 35 percent tax rate receives : a firm that owns the stock of another corporation does not have to pay taxes on the entire amount of dividends
Inventories represent a considerable investment for every : question 1an inventory management decision modelinventories represent a considerable investment for every organization
A determine the regression equation b what is the value of : frans convenience marts are located throughout a metropolitan area. fran the owner would like to expand into other
Using big-o notation state the runtime for this algorithm : 1 consider searching algorithms on the following array of datanbsp22 21 9 4 16 2 10 14 20 31 26 19 17 28 8
Conduct a test of hypothesis to determine whether either : question in a multiple regression equation two independent variables are considered and the sample size is 25. the
Compute the standard error of estimate about 95 of the : refer to the following anova
Similarly most other countries have not in the past : 1. in 1929 there were more than 25000 commercial banks in the u.s. today there are still approximately 7000 banks. in
Adam borrows 4500 at 12 percent annually compounded : 1. adam borrows 4500 at 12 percent annually compounded interest to be repaid in four equal annual installments. the

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Explaining view of header and footer areas of worksheet

In which view can you see header and footer areas of worksheet?

  Programming language problems

Many programming languages do not permit you to ask two or more questions in a single comparison by using a logical And Operator

  Write a method that finds the average age of the students

Write a method that finds the average age of the students stored in the data structure and some Java code that could be used in a test program to display the value returned by the method on the console or command prompt.

  Design algorithm to produce list of customers

Design an algorithm to produce a list of customers from the Glad Rags Clothing Company's customer master file. Each record on the customer master file contains the customer's number.

  Prepare a japplet with a jbutton

Prepare a JApplet with a JButton labeled Who is number one and when the user clicks on button, display your favorite sports team. Save the document as JNumberOne.java.

  Design an o(v+e) time algorithm that computes

Design an O(V+E) time algorithm that computes the smallest number of batches required to complete all tasks. A task can be assigned to a batch i if and only if all tasks that are its prerequisites have already been assigned to batches 1 to (i-1).

  Describe a fair coin algorithm to returns either 0 or 1

Describe a FAIRCOIN algorithm that returns either 0 or 1 with equal probability, using ONEINTHREE as your only source of randomness.

  Organizing the data in ms excel

Many of your family members have discovered that you are using Excel to organize the information for the high school reunion. Your Uncle Larry wants to make an inventory of the over 800 video games that he collects.

  Creating an idef1x diagram

Construct an IDEF1X diagram that demonstrate only entities and relationships. Name each relationship and specify its cardinalities.

  A and b, both of which perform the same function

Assume you have two algorithms, A and B, both of which perform the same function,

  Implement a queue as a circular array

Implement a queue as a circular array as follows: Use two index variables head and tail that contain the index of the next element to be removed and the next element to be added.

  Find the average number of bits needed to encode

Suppose that the symbols are compressed using Huffman Coding and that the most likely symbol is encoded as a 0, determine the decompressed value of the following compressed string of bits?

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