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
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
Chapter3: Data Representation
Section: Chapter Questions
Problem 12VE
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](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fc38cd003-ad52-4a8d-b0a4-f836daddf66c%2F616bb63f-1d45-458f-8b02-0432f3e157c6%2Fvfo4xg7_processed.jpeg&w=3840&q=75)
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](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fc38cd003-ad52-4a8d-b0a4-f836daddf66c%2F616bb63f-1d45-458f-8b02-0432f3e157c6%2Fyhtnd2_processed.jpeg&w=3840&q=75)
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
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
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
![Systems Architecture](https://www.bartleby.com/isbn_cover_images/9781305080195/9781305080195_smallCoverImage.gif)
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning
![Systems Architecture](https://www.bartleby.com/isbn_cover_images/9781305080195/9781305080195_smallCoverImage.gif)
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning