Data: 12 8 33 61 1 54 4 97 28 79 Pass 0: Minimum is 1 and its position is 4 Enqueue 1 to queue Data: 12 8 33 61 1000 54 4 97 28 79 Pass 1: Minimum is 4 and its position is 6

Systems Architecture
7th Edition
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Stephen D. Burd
Chapter3: Data Representation
Section: Chapter Questions
Problem 12VE
icon
Related questions
Question
Data:
12 8 33 61 1 54 4 97 28 79
Pass 0: Minimum is 1 and its position is 4
Enqueue 1 to queue
Data:
12 8 33 61 1000 54 4 97 28 79
Pass 1: Minimum is 4 and its position is 6
Enqueue 4 to queue
Data:
12 8 33 61 1000 54 1000 97 28 79
Pass 2: Minimum is 8 and its position is 1
Enqueue 8 to queue
Data:
12 1000 33 61 1000 54 1000 97 28 79
Pass 3: Minimum is 12 and its position is 0
Enqueue 12 to queue
Transcribed Image Text:Data: 12 8 33 61 1 54 4 97 28 79 Pass 0: Minimum is 1 and its position is 4 Enqueue 1 to queue Data: 12 8 33 61 1000 54 4 97 28 79 Pass 1: Minimum is 4 and its position is 6 Enqueue 4 to queue Data: 12 8 33 61 1000 54 1000 97 28 79 Pass 2: Minimum is 8 and its position is 1 Enqueue 8 to queue Data: 12 1000 33 61 1000 54 1000 97 28 79 Pass 3: Minimum is 12 and its position is 0 Enqueue 12 to queue
Write a C program to sort items of the data in descending order by using queue data structure. An
example for sorting operation is given below:
Data: 128 33 61154 4 97 28 79
Sorted data: 9779 61 54 33 28 12 84 1
a) Open a sequential-access file
b) Define an array that stores 10 integer numbers (i.e. numbers[10]), then initialize the array with the
given data
c) Print the data to the screen
d) Write the data to the file
e) To sort the data you have to perform 10 passes. For each pass, you have to find minimum item and
its index. Enqueue the item to the queue and set 1000 to appropriate position
f) For each pass, write the appropriate text according to the Figure 1 to the file
8) Print the queue
h) Write the queue to the file. You have to implement all statements in main function
i) Dequeue the items from the queue and assign appropriate positions in the array. Also write the
appropriate text according to the Figure 1 to the file
j) Print the sorted data to the screen
k) Write the sorted data to the file
Transcribed Image Text:Write a C program to sort items of the data in descending order by using queue data structure. An example for sorting operation is given below: Data: 128 33 61154 4 97 28 79 Sorted data: 9779 61 54 33 28 12 84 1 a) Open a sequential-access file b) Define an array that stores 10 integer numbers (i.e. numbers[10]), then initialize the array with the given data c) Print the data to the screen d) Write the data to the file e) To sort the data you have to perform 10 passes. For each pass, you have to find minimum item and its index. Enqueue the item to the queue and set 1000 to appropriate position f) For each pass, write the appropriate text according to the Figure 1 to the file 8) Print the queue h) Write the queue to the file. You have to implement all statements in main function i) Dequeue the items from the queue and assign appropriate positions in the array. Also write the appropriate text according to the Figure 1 to the file j) Print the sorted data to the screen k) Write the sorted data to the file
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Types of Protocols
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
  • SEE MORE QUESTIONS
Recommended textbooks for you
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning