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

  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