For each question, an algorithm will be described that operates on N elements, and your answer should include: (a) a big-O expression that describes the total number of operations in the worst case (for ex- ample, O(N³)) (b) a description of how to achieve the same effect as the algorithm described, but achieved with a better big-O time bound (for example, "use mergesort instead of insertion sort") (c) the big-O time bound for your improved approach. Your improved algorithm does not need to be provably the best possible, but it should have a different and better big-O bound. (It may not be as simple as substituting one named algorithm for another; consider what is redundant about the work done by the existing algorithm.) You don't need to use pseudocode to describe your algorithms - the style used in the problem descriptions is also sufficient for your solutions. You can use pseudocode if you like. Do not write

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
For each question, an algorithm will be described that operates on N elements, and your answer
should include:
(a) a big-O expression that describes the total number of operations in the worst case (for ex-
ample, O(N³))
(b) a description of how to achieve the same effect as the algorithm described, but achieved with a
better big-O time bound (for example, "use mergesort instead of insertion sort")
(c) the big-O time bound for your improved approach.
Your improved algorithm does not need to be provably the best possible, but it should have a
different and better big-O bound. (It may not be as simple as substituting one named algorithm
for another; consider what is redundant about the work done by the existing algorithm.)
You don't need to use pseudocode to describe your algorithms - the style used in the problem
descriptions is also sufficient for your solutions. You can use pseudocode if you like. Do not write
real code. If you wish to use an algorithm described in class, you can name it and describe how it
would be used; no need to copy out its pseudocode.
i. For each number in an array A of N integers: add that number to every element of array B,
which also contains N integers. (Count just the addition operations.)
ii. To find the second largest value in an unsorted linked list: mergesort the list, then return the
second element from the end. (Count comparisons.)
iii. For this question, the input is an array where the integers are all 0 or 1, and all the 0's come
before all the l's. The task is to find the point where the first 1 occurs. The algorithm to
improve is moving down the array from its left end to its right, stopping when the first 1
is encountered. It is possible there are no l's, and it is possible there are no 0's. Count
comparisons (to 0 or 1).
Transcribed Image Text:For each question, an algorithm will be described that operates on N elements, and your answer should include: (a) a big-O expression that describes the total number of operations in the worst case (for ex- ample, O(N³)) (b) a description of how to achieve the same effect as the algorithm described, but achieved with a better big-O time bound (for example, "use mergesort instead of insertion sort") (c) the big-O time bound for your improved approach. Your improved algorithm does not need to be provably the best possible, but it should have a different and better big-O bound. (It may not be as simple as substituting one named algorithm for another; consider what is redundant about the work done by the existing algorithm.) You don't need to use pseudocode to describe your algorithms - the style used in the problem descriptions is also sufficient for your solutions. You can use pseudocode if you like. Do not write real code. If you wish to use an algorithm described in class, you can name it and describe how it would be used; no need to copy out its pseudocode. i. For each number in an array A of N integers: add that number to every element of array B, which also contains N integers. (Count just the addition operations.) ii. To find the second largest value in an unsorted linked list: mergesort the list, then return the second element from the end. (Count comparisons.) iii. For this question, the input is an array where the integers are all 0 or 1, and all the 0's come before all the l's. The task is to find the point where the first 1 occurs. The algorithm to improve is moving down the array from its left end to its right, stopping when the first 1 is encountered. It is possible there are no l's, and it is possible there are no 0's. Count comparisons (to 0 or 1).
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Lower bounds sorting algorithm
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education