1. Write an algorithm (in readable pseudocode) that finds the beginning and end points (the index...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
1. Write an algorithm (in readable pseudocode) that finds the beginning and end points (the index in the sequence) of the longest string of repeating digits in a sequence of random digits (0...9) of length n. If there is more than one sequence of the same length, return the first one. If there are no repeating digits, return both indices as 1. 2. Write an algorithm (pseudocode again) that takes an unsorted list of n real numbers and finds the two numbers (their actual values) that are closest together. Calculate the total number of comparisons (leaving out any loop index operations) and use that to identify what order time complexity this algorithm is 3. Demonstrate a proof of the following statements using the definition of big-O a. If f(x) is O(g₁ (x)) and f_2 (x) is 0(92(x)) then (fi + f₂)(x) is 0(max(191 (x)1.192 (x))) b. If f(x) is 0 (g(x)) and f2(x) is 0(92(x)) then (fi fa)(x) is 0(91(x)92(x)) 4. Using the definition of big-O and specific values of C and k a. Show that n! is NOT O(2") b. Show that (logn)2 IS O(n) where log is base 2 5. Show that f(x) = 2x2-x+3 is e(x2) by finding C₁, C₂ and k in the definition of big-Theta 6. Using the worst case time and assuming a sorting algorithm no better than O(n log n) find the time complexity (and explain) of the greedy scheduling algorithm based on earliest end times. 6. Using the worst case time and assuming a sorting algorithm no better than O(n log n) find the time complexity (and explain) of the greedy scheduling algorithm based on earliest end times. procedure schedule(s1, s2, el, e2, ... sn: start times, .... en: end times) sort talks by finish time and reorder so that el Se2 s... Sen S:= 0 for j := 1 to n if talk j is compatible with S then S:=SU {talk j} return S 1. Write an algorithm (in readable pseudocode) that finds the beginning and end points (the index in the sequence) of the longest string of repeating digits in a sequence of random digits (0...9) of length n. If there is more than one sequence of the same length, return the first one. If there are no repeating digits, return both indices as 1. 2. Write an algorithm (pseudocode again) that takes an unsorted list of n real numbers and finds the two numbers (their actual values) that are closest together. Calculate the total number of comparisons (leaving out any loop index operations) and use that to identify what order time complexity this algorithm is 3. Demonstrate a proof of the following statements using the definition of big-O a. If f(x) is O(g₁ (x)) and f_2 (x) is 0(92(x)) then (fi + f₂)(x) is 0(max(191 (x)1.192 (x))) b. If f(x) is 0 (g(x)) and f2(x) is 0(92(x)) then (fi fa)(x) is 0(91(x)92(x)) 4. Using the definition of big-O and specific values of C and k a. Show that n! is NOT O(2") b. Show that (logn)2 IS O(n) where log is base 2 5. Show that f(x) = 2x2-x+3 is e(x2) by finding C₁, C₂ and k in the definition of big-Theta 6. Using the worst case time and assuming a sorting algorithm no better than O(n log n) find the time complexity (and explain) of the greedy scheduling algorithm based on earliest end times. 6. Using the worst case time and assuming a sorting algorithm no better than O(n log n) find the time complexity (and explain) of the greedy scheduling algorithm based on earliest end times. procedure schedule(s1, s2, el, e2, ... sn: start times, .... en: end times) sort talks by finish time and reorder so that el Se2 s... Sen S:= 0 for j := 1 to n if talk j is compatible with S then S:=SU {talk j} return S
Expert Answer:
Answer rating: 100% (QA)
1 Algorithm to find the longest string of repeating digits LongestRepeatingDigitssequence maxLen 0 s... View the full answer
Related Book For
Accounting for Decision Making and Control
ISBN: 978-0078025747
8th edition
Authors: Jerold Zimmerman
Posted Date:
Students also viewed these mathematics questions
-
A newspaper printing press system is more than one hundred feet long, stands four or five stories tall, and weighs 2 million pounds. Only about ten of the systems are sold each year in the United...
-
If you perform your break-even analysis and there is more than one solution, explain how you would determine which x-values are profit and which are not.
-
The total assets and liabilities at the beginning and end of the year for Schupan Company are listed below: Determine Schupan Company's net income or loss for the year under each of the following...
-
Linking every transport stakeholder together and ensuring seamless travel across Europe is a dream. With this objective, Amadeus, a leading global travel technology player, initiated a novel idea of...
-
Chudzick Small Engine Repair charges $45 per hour of labor. It has a material loading percentage of 40%. On a recent job replacing the engine of a riding lawnmower, Chudzick worked 10.5 hours and...
-
At the end of 2024, Barker Corporations preliminary trial balance indicated a current ratio of 1.2. Management is contemplating paying some of its accounts payable balance before the end of the...
-
Consider the Michaelis-Menten model introduced in Eq. (12.23). Graph the expectation function for this model for \(\theta_{1}=200\) and \(\theta_{2}=0.04,0.06,0.08\), 0.10 . Overlay these curves on...
-
Schiffer Corporation manufactures agricultural machinery. At a recent staff meeting, the following direct-labor variance report for the year just ended was presented by the controller. Schiffers...
-
Image transcription text 1. 2. Before you start: Have you done all the practice quizzes, including the one on sigificant figures? The quizzes do not count formarks, and some of the quiz questions are...
-
Today is Dec 31, 2020. THP is a clothing retailer that started its business 20 years ago. It currently has two locations within Scarborough Town Centre shopping mall, one near Entrance A (Location...
-
Mark weighs 74 pounds. Together, he and his sister weigh six pounds more than three times the weight of his sister. What is the weight, w, of Mark's sister?
-
Manufacturing costs for Davenport Company during 2018 were as follows: Beginning Finished Goods, January 1 Beginning Raw Materials, January 1 Beginning Work in Process, January 1 Direct Labor for the...
-
Direct labor-hours required to support estimated production Machine-hours required to support estimated production Fixed manufacturing overhead cost Variable manufacturing overhead cost per direct...
-
Based on your work above, compete the Income Statement through Gross Profit for PDI Do not use the dollar sign ( $ ) . Use whole numbers only ( no decimal places ) . PDI Income Statement Account...
-
crumble company constructed the following formula for monthly electrical costs. Total electricity costs = $ 1 , 5 0 0 + ( $ 8 . 1 0 X labor hour ) assume that 6 4 0 labor hours are budgeted for the...
-
Explain the challenges Agile teams have building release deliverables into their sprints and why a release sprint could be required.
-
Most investors or investees should review the financial statements of any company prior to making their decision, as would represent a fair presentation. In addition, the scale or size are major...
-
What steps must a business take to implement a program of social responsibility?
-
Christian Childrens Fund, Inc. (CCF), established in 1938, is an international, nonsectarian, non-profit organization dedicated to assisting children. With program offices around the world, it...
-
New York Fashions owns 87 womens clothing stores in shopping malls. Corporate headquarters of New York Fashions uses flexible budgets to control the operations of each of the stores. The following...
-
APC is a contract manufacturer of printed circuit board assemblies that specializes in manufacturing and test engineering support of complex printed circuit boards for companies in the defense and...
-
Describe what sexual harassment is and what forms it can take.
-
Describe what is meant by retaliatory and constructive discharge and how to defend a claim for unfair discharge.
-
Explain public policies that protect employees from unlawful discharge.
Study smarter with the SolutionInn App