4. Take input from a file (Input-Assignment1-Problem-2.txt), which will first have the number of test cases (T). For each case/line, there will be • n (array's size) • 0/1 (i.e. zero OR one), indicating whether sorting is to be done in ascending order or descending order for this test case. o 0- Ascending order o 1- Descending order • 0/1/2 (zero OR one OR two), indicating which sorting technique will be used for this test case. o 0- Selection Sort will be called o 1- Insertion Sort will be called o 2- Merge Sort will be called

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

Do not copy. I need the code in c++ format.

4. Take input from a file (Input-Assignment1-Problem-2.txt), which will first have
the number of test cases (T).
For each case/line, there will be
• n (array's size)
• 0/1 (i.e. zero OR one), indicating whether sorting is to be done in
ascending order or descending order for this test case,
o 0- Ascending order
1- Descending order
• 0/1/2 (zero OR one OR two), indicating which sorting technique will be
used for this test case.
o 0- Selection Sort will be called
o 1- Insertion Sort will be called
o 2- Merge Sort will be called
Followed by Array's elements.
For each test case, you have to write to an output file the ascending or
descending sorted order. You have to write in the following format.
Maintain the exact format.
Output file will be named <ROLL>-Output-Assignment-1-Problem-2.txt
Eg.
If your roll is 1505022, then output file will be
1505022-Output-Assignment1-Problem2.txt
[See next page for sample input and output formats]
Sample Input (Input-Assignment1-Problem-2.txt):
3
400
22 4 51
10 11
12 10 31 22 8 11 15 19 5
312
132
Sample Output (eg. 1505022-Output-Assignment1-Problem2.txt)
Test Case #1
Size: 4, Order: Ascending, Technique: Selection
145 22
Test Case #2
Size: 10, Order: Descending, Technique: Insertion
31 22 19 15 11 10 9521
Test Case #3
Size: 3, Order: Descending, Technique: Merge
321
Transcribed Image Text:4. Take input from a file (Input-Assignment1-Problem-2.txt), which will first have the number of test cases (T). For each case/line, there will be • n (array's size) • 0/1 (i.e. zero OR one), indicating whether sorting is to be done in ascending order or descending order for this test case, o 0- Ascending order 1- Descending order • 0/1/2 (zero OR one OR two), indicating which sorting technique will be used for this test case. o 0- Selection Sort will be called o 1- Insertion Sort will be called o 2- Merge Sort will be called Followed by Array's elements. For each test case, you have to write to an output file the ascending or descending sorted order. You have to write in the following format. Maintain the exact format. Output file will be named <ROLL>-Output-Assignment-1-Problem-2.txt Eg. If your roll is 1505022, then output file will be 1505022-Output-Assignment1-Problem2.txt [See next page for sample input and output formats] Sample Input (Input-Assignment1-Problem-2.txt): 3 400 22 4 51 10 11 12 10 31 22 8 11 15 19 5 312 132 Sample Output (eg. 1505022-Output-Assignment1-Problem2.txt) Test Case #1 Size: 4, Order: Ascending, Technique: Selection 145 22 Test Case #2 Size: 10, Order: Descending, Technique: Insertion 31 22 19 15 11 10 9521 Test Case #3 Size: 3, Order: Descending, Technique: Merge 321
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Arrays
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