
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
thumb_up100%
Build a flowchart for this program using an insertion sort.
1. leave out getScores(), displayScores(), and swap() functions calls to them.
2. In the main() module, reduce the scores[ ] array to 6 and initialize it with these numbers upon declaration: [9, 5, 1, 6, 9, 4].
3. Also in the main() module, replace the call to displayScores() with one line that will display all the array's contents: Display scores.
4. And to swap array elements, replicate the whole insertionSort() function as you see on page 444
![444
Chapter 9
Sorting and Searching Arrays
Figure 9-24 Flowchart for the insertionSort module
insertionSort
(Integer Ref array[ ].
Integer arraySize)
Declare Integer index
Declare Integer scan
Declare Integer
unsortedValue
Set index = 1
True
index <=
arraySize – 1
Set unsortedValue =
array[index]
False
Set scan = index
Return
scan > 0 AND
True
array[scan-1] >
unsortedValue
Set array[scan] =
array[scan-1]
False
Set array[scan] =
unsortedValue
Set scan =
scan - 1
Set index =
index + 1](https://content.bartleby.com/qna-images/question/4953b7b2-2d45-45b3-be8a-b0753172ec10/af01d1ac-1d69-4ed7-8c84-db0ebddeb010/1ihcz5_thumbnail.jpeg)
Transcribed Image Text:444
Chapter 9
Sorting and Searching Arrays
Figure 9-24 Flowchart for the insertionSort module
insertionSort
(Integer Ref array[ ].
Integer arraySize)
Declare Integer index
Declare Integer scan
Declare Integer
unsortedValue
Set index = 1
True
index <=
arraySize – 1
Set unsortedValue =
array[index]
False
Set scan = index
Return
scan > 0 AND
True
array[scan-1] >
unsortedValue
Set array[scan] =
array[scan-1]
False
Set array[scan] =
unsortedValue
Set scan =
scan - 1
Set index =
index + 1

Transcribed Image Text:Programming Exercises
1. Sorted Golf Scores
Design a program that asks the user to enter 10 golf scores. The scores should be
stored in an Integer array. Sort the array in ascending order and display its
ores
contents.
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 5 steps with 3 images

Knowledge Booster
Similar questions
- Please use C++ and make sure it's for a sorted array Write a function, removeAll, that takes three parameters: an array of integers,the number of elements in the array, and an integer (say, removeItem). Thefunction should find and delete all of the occurrences of removeItem in thearray. If the value does not exist or the array is empty, output an appropriatemessage. (Note that after deleting the element, the number of elements in thearray is reduced.) Assume that the array is sorted.arrow_forwardCreate a function append(v, a, n) that adds to the end of vector v a copy of all the elements of array a. For example, if v contains 1,2, 3, and a contains 4, 5, 6, then v will end up containing 1, 2, 3, 4, 5,6. The argument n is the size of the array. The argument v is a vector ofintegers and a is an array of integers. Write a test driver.arrow_forward2. Fill in the for-loop below with the correct parameters to make room for the new value. saved Let's say that you have to write a function to insert an element into an ordered array. It takes an array A, a size, an index and a value. The value needs to be inserted at Aſindex] without losing values that are already in the array. // Assume that the index is found to be within array bounds and there is room to insert. for (int i = ?; ?; ?) { A[i]=A[i-1]; } A[index]=value; size++; O 0; i 0; - O size; i> index; -- O size-1; i>= index; i--arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY

Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON

Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education

Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY