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

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
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
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