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

  Yaou will now look at stacks and queues using linked lists

you will now look at stacks and queues using linked lists. complete the following for this assignment1 create a

  Create a program to calculate each income bracket

People from 3-different income levels, A, B, and C, rated each of 2-different items with a number 0 through 10. Create a file in which each line contains the income level and item rankings for one respondent.

  Explain how to modify knuth-morris-pratt algorithm

Explain how to modify Knuth-Morris-Pratt algorithm to support patterns with these wild cards, and analyze modified algorithm. Your algorithm must find first substring in text which matches the pattern.

  Describe the requirement for complex data structures

Describe the requirement for complex data structures and how they are utilized. Describe the design and application of arrays and how the array simplifies program development.

  .specify and define a method for linkedbag

Add a constructor to the class LinkedBag that creates a bag from a given array of entries.Specify and define a method for LinkedBag that removes a random entry from the bag.

  One e business failure

Discuss about one e-Business failure. Describe what happened and what you would have done differently. Explain whether or not the e-Business practiced sound financial planning.

  Program development cycle for algorithm using pseudocode

Illustrate all your work. Use modular approach to solving this problem. Give the following submodule. Calculations - module to compute gross pay. Using the Program Development Cycle, develop an algorithm using pseudocode for the following task.

  Algorithm to produce schedule for least completion time

What is the best order for sending people out, if one wants whole competition to be over as early as possible? More precisely, provide efficient algorithm which produces schedule whose completion time is as small as possible.

  The generic height and width of each bookcase.

Write a solution (one calculation algorithm) to print the number of feet (Variable: Number_Boardfeet) of 12-inch-wide boards that Joe will need to complete any given bookcase, given the generic height and width of each bookcase.

  Convert the following expression in postfix

Convert the following expression in postfix (reverse Polish notation). Remember the rules of precedence for arithmetic operators. To get full credit, you need to show all work done. i.e. sample snapshot of the stack

  Sketch flowchart for logic of program to enter three values

Sketch a flowchart or write psuedocode to represent logic of a program that alllows the user to enter three values .

  Making visual studio.net web application

Make a Visual Studio.NET 2005 web application with 2-aspx forms. Add a Menu control and a Label control to form. Populate the Menu control with data stored in the "Font" column and show your name in the Label control.

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