1. Consider the algorithm for the sorting problem that sorts an array by counting, for each of its elements, the number of smaller elements and then uses this information to put the element in its appropriate position in the sorted array: ALGORITHM Comparison Counting Sort(A[0..n-1]) //Sorts an array by comparison counting //Input: Array A[0..n-1] of orderable values //Output: Array S[0..n - 1] of A's elements sorted in nondecreasing order // for i 0 to n - 1 do ← Count[i]<0 -0 to n - 2 do for ji+1 to n - 1 do if A[i]

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

#1

applications. But in the last
its focus to business applications. These new applications require primarily algo-
rithms for information storage, retrieval, transportation through networks, and
presentation to users. As a result of this revolutionary change, numerical analysis
has lost its formerly dominating position in both industry and computer science
programs. Still, it is important for any computer-literate person to have at least a
rudimentary idea about numerical algorithms. We discuss several classical numer-
ical algorithms in Sections 6.2, 11.4, and 12.4.
- Exercises 1.3
1. Consider the algorithm for the sorting problem that sorts an array by counting,
for each of its elements, the number of smaller elements and then uses this
information to put the element in its appropriate position in the sorted array:
ALGORITHM Comparison Counting Sort (A[0..n-1])
//Sorts an array by comparison counting
//Input: Array A[0..n - 1] of orderable values
//Output: Array S[0..n - 1] of A's elements sorted
in nondecreasing order
//
for i 0 to n - 1 do
Count[i]<0
for i 0 to n - 2 do
for ji+1 to n - 1 do
if A[i] < A[j]
Count[j]Count[j]+1
else Count[i] Count[i] + 1
for i 0 to n - 1 do
S[Count[i]] A[i]
return S
a. Apply this algorithm to sorting the list 60, 35, 81, 98, 14, 47.
b. Is this algorithm stable?
c. Is it in-place?
2. Name the algorithms for the searching problem that you already know. C
a good succinct description of each algorithm in English. If you know no s
algorithms, use this opportunity to design one.
orithm for the string-matching problem.
Transcribed Image Text:applications. But in the last its focus to business applications. These new applications require primarily algo- rithms for information storage, retrieval, transportation through networks, and presentation to users. As a result of this revolutionary change, numerical analysis has lost its formerly dominating position in both industry and computer science programs. Still, it is important for any computer-literate person to have at least a rudimentary idea about numerical algorithms. We discuss several classical numer- ical algorithms in Sections 6.2, 11.4, and 12.4. - Exercises 1.3 1. Consider the algorithm for the sorting problem that sorts an array by counting, for each of its elements, the number of smaller elements and then uses this information to put the element in its appropriate position in the sorted array: ALGORITHM Comparison Counting Sort (A[0..n-1]) //Sorts an array by comparison counting //Input: Array A[0..n - 1] of orderable values //Output: Array S[0..n - 1] of A's elements sorted in nondecreasing order // for i 0 to n - 1 do Count[i]<0 for i 0 to n - 2 do for ji+1 to n - 1 do if A[i] < A[j] Count[j]Count[j]+1 else Count[i] Count[i] + 1 for i 0 to n - 1 do S[Count[i]] A[i] return S a. Apply this algorithm to sorting the list 60, 35, 81, 98, 14, 47. b. Is this algorithm stable? c. Is it in-place? 2. Name the algorithms for the searching problem that you already know. C a good succinct description of each algorithm in English. If you know no s algorithms, use this opportunity to design one. orithm for the string-matching problem.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 6 steps

Blurred answer
Knowledge Booster
Recurrence Relation
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.
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