For each of the following six program fragments: a. Give an analysis of the running time (Big-Oh
Question:
a. Give an analysis of the running time (Big-Oh will do).
b. Implement the code in Java, and give the running time for several values of N.
c. Compare your analysis with the actual running times.
(1) sum = 0;
for( i = 0; i < n; i++ )
sum++;
(2) sum = 0;
for( i = 0; i < n; i++ )
for( j = 0; j < n; j++ )
sum++;
(3) sum = 0;
for( i = 0; i < n; i++ )
for( j = 0; j < n * n; j++ )
sum++;
(4) sum = 0;
for( i = 0; i < n; i++ )
for( j = 0; j < i; j++ )
sum++;
(5) sum = 0;
for( i = 0; i < n; i++ )
for( j = 0; j < i * i; j++ )
for( k = 0; k < j; k++ )
sum++;
(6) sum = 0;
for( i = 1; i < n; i++ )
for( j = 1; j < i * i; j++ )
if( j % i == 0 )
for( k = 0; k < j; k++ )
sum++;
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 60% (15 reviews)
For all these programs the following analysis will agree with a simulatio...View the full answer
Answered By
Ashington Waweru
I am a lecturer, research writer and also a qualified financial analyst and accountant. I am qualified and articulate in many disciplines including English, Accounting, Finance, Quantitative spreadsheet analysis, Economics, and Statistics. I am an expert with sixteen years of experience in online industry-related work. I have a master's in business administration and a bachelor’s degree in education, accounting, and economics options.
I am a writer and proofreading expert with sixteen years of experience in online writing, proofreading, and text editing. I have vast knowledge and experience in writing techniques and styles such as APA, ASA, MLA, Chicago, Turabian, IEEE, and many others.
I am also an online blogger and research writer with sixteen years of writing and proofreading articles and reports. I have written many scripts and articles for blogs, and I also specialize in search engine
I have sixteen years of experience in Excel data entry, Excel data analysis, R-studio quantitative analysis, SPSS quantitative analysis, research writing, and proofreading articles and reports. I will deliver the highest quality online and offline Excel, R, SPSS, and other spreadsheet solutions within your operational deadlines. I have also compiled many original Excel quantitative and text spreadsheets which solve client’s problems in my research writing career.
I have extensive enterprise resource planning accounting, financial modeling, financial reporting, and company analysis: customer relationship management, enterprise resource planning, financial accounting projects, and corporate finance.
I am articulate in psychology, engineering, nursing, counseling, project management, accounting, finance, quantitative spreadsheet analysis, statistical and economic analysis, among many other industry fields and academic disciplines. I work to solve problems and provide accurate and credible solutions and research reports in all industries in the global economy.
I have taught and conducted masters and Ph.D. thesis research for specialists in Quantitative finance, Financial Accounting, Actuarial science, Macroeconomics, Microeconomics, Risk Management, Managerial Economics, Engineering Economics, Financial economics, Taxation and many other disciplines including water engineering, psychology, e-commerce, mechanical engineering, leadership and many others.
I have developed many courses on online websites like Teachable and Thinkific. I also developed an accounting reporting automation software project for Utafiti sacco located at ILRI Uthiru Kenya when I was working there in year 2001.
I am a mature, self-motivated worker who delivers high-quality, on-time reports which solve client’s problems accurately.
I have written many academic and professional industry research papers and tutored many clients from college to university undergraduate, master's and Ph.D. students, and corporate professionals. I anticipate your hiring me.
I know I will deliver the highest quality work you will find anywhere to award me your project work. Please note that I am looking for a long-term work relationship with you. I look forward to you delivering the best service to you.
3.00+
2+ Reviews
10+ Question Solved
Related Book For
Data Structures and Algorithm Analysis in Java
ISBN: 978-0132576277
3rd edition
Authors: Mark A. Weiss
Question Posted:
Students also viewed these Computer Sciences questions
-
For each of the following SQL queries, for each relation involved, list the attributes that must be examined to compute the answer. All queries refer to the following relations: Emp(eid: integer,...
-
For each of the following SQL queries, for each relation involved, list the attributes that must be examined to compute the answer. All queries refer to the following relations: Emp(eid: integer,...
-
For each of the following system calls, give a condition that causes it to fail: fork, exec, and unlink.
-
QUESTION ONE Matrix X sells computer hardware and software components as well as other ancillary items to customers all over South Africa. Matrix X also provides installation of hardware and software...
-
A projectile, initially at the origin, moves along a straight-line path through a fluid medium such that its velocity is v = 1800 (1 - e -03e) mm/s, where t is in seconds. Determine the displacement...
-
The towline exerts a force of P = 6 kN at the end of the 8-m-long crane boom. If u = 30, determine the placement x of the hook at B so that this force creates a maximum moment about point O. What is...
-
6. Identify and describe two private-transaction approaches to corporate divestiture and two public-transaction approaches. When are private transactions likely to create more value than public...
-
The weekly time tickets indicate the following distribution of labor hours for three direct labor employees: The direct labor rate earned per hour by the three employees is as follows: Tom Couro...
-
Lean Accounting Westgate in the lean manufacturing strategy to manche DVR (digital video recorder) player. The company manufactures Dit players through the producto The budgeted Com for the year is...
-
Security A pays $30 if state 1 occurs and $10 if state 2 occurs. Security B pays $20 if state 1 occurs and $0 if state 2 occurs. The price of security A is $5, and the price of security B is $10. (a)...
-
Explain how an understanding of consumers learning processes might affect marketing strategy planning. Give an example.
-
Suppose you need to generate a random permutation of the first N integers. For example, {4, 3, 1, 5, 2} and {3, 1, 4, 2, 5} are legal permutations, but {5, 4, 1, 2, 1} is not, because one number (1)...
-
Based on the following information, calculate the expected return and standard deviation for the two stocks: Rate of Return if State Occurs State of Economy Recession Normal Boom Probability of State...
-
Using a ruler and set squares only, construct the following shapes: a. b. c. d. 5cm 5cm
-
The marketing department has just forecast that 10,000 units of item 778 will be ordered in the next fiscal year. Based on the marketing department's forecast and noting that the seasonal relative...
-
Following are interaction plots for three data sets. Which data set has the largest interactions? Which has the smallest? A B C
-
From your local chamber of commerce, obtain the population figures for your city for the years \(1980,1990,2000\), and 2010. Find the rate of growth for each period. Forecast the population of your...
-
A mass \(m\) is attached at the midpoint of a stretched wire of area of cross-section \(A\), length \(l\), and Young's modulus \(E\) as shown in Fig. 13.29. If the initial tension in the wire is...
-
In Exercises 7 through 10, p = D(q) is the price (dollars per unit) at which q units of a particular commodity will be demanded by the market (that is, all q units will be sold at this price), and q...
-
Reread the discussion leading to the result given in (7). Does the matrix sI - A always have an inverse? Discuss.
-
A group of 2n - 1 router is interconnected in a centralized binary tree, with a router at each tree node. Router i communicate with router j by sending a message to the root of the tree. The root...
-
A disadvantage of a broadcast subnet is the capacity wasted when multiple hosts attempt to access the channel at the same time. As a simplistic example, suppose that time is divided into discrete...
-
What are two reasons for using layered protocols?
-
thumbs up if correct A stock paying no dividends is priced at $154. Over the next 3-months you expect the stock torpeither be up 10% or down 10%. The risk-free rate is 1% per annum compounded...
-
Question 17 2 pts Activities between affiliated entities, such as a company and its management, must be disclosed in the financial statements of a corporation as O significant relationships O segment...
-
Marchetti Company, a U.S.-based importer of wines and spirits, placed an order with a French supplier for 1,000 cases of wine at a price of 200 euros per case. The total purchase price is 200,000...
Study smarter with the SolutionInn App