
Concept explainers
C POGRAM
The objective is to be able to implement sorting algorithms to sort a sequence of numbers.
1. Make a code for a program that follows the details in the PROGRAM SPECIFICATION section.
2. Develop a program following the structured
PROGRAM SPECIFICATION
Write a program that implements three specified sorting algorithms and use each to sort an array of numbers. The sorting algorithms you are to implement are: SELECTION, MERGE, and RADIX.
Your program should have the following main menu:
Sorting Demonstration
[1] Input array
[2] Display array
[3] Perform SELECTION SORT
[4] Perform MERGE SORT
[5] Perform RADIX SORT
[0] Exit
Enter choice:
Details of the menu items are as follows:
Input array: Once selected, the user is asked for the size of the array and the numbers to be stored to the array. Note: you are to implement a dynamic array to accommodate varying array sizes.
Display array: Once selected, the program should display the content of the original input array.
Perform SELECTION SORT: Once selected, the program should apply the selection sort
Perform MERGE SORT: The function of this menu item should be the same as that of menu item [3] except that merge sort is used instead of selection sort.
Perform RADIX SORT: The function of this menu item should be the same as that of menu item [3] except that radix sort is used instead of selection sort.
Exit: Once selected, the program should terminate with a message informing the user that the program has ended.
Important:
1. Each sorting process should not modify the original array.
2. If the process is to be performed on an empty array, simply inform the user that the process cannot be done because the array is empty.
3. At the end of each process, the program should display a message appropriate to the result of the process.
4. After processing the selected main menu item, the program should loop back to the main menu. The program should end only when the user selects the main menu item Exit.

Step by stepSolved in 3 steps with 5 images

- Programming Language :- Carrow_forwardTopical Information Use C++. This lab will help you practice with dynamic memory (NOT mixed with classes). Program Information One statistic of interest to many researchers is the median of a set of data. The median is the value in the middle. (This is NOT the average, mind you.) Being in the middle, of course implies that the data are in order (sorted). If there are an odd number of data items, the middle is simple to find. If there are an even number of data items, you are supposed to take the average of the two middle values. You'll need to find the median of a set of data from a file. You don't know how many data are in the file, of course. You'll have to count the data, then read them in to sort, then find the median, and finally print it (the median) out. Do NOT use any more memory than is necessary!!arrow_forwardPython 6. Sum of Numbers Design a function that accepts an integer argument and returns the sum of all the integers from 1 up to the number passed as an argument. For example, if 50 is passed as an argument, the function will return the sum of 1, 2, 3, 4, ...50. Use recursion to calculate • the sum.arrow_forward
- C++ program: Write a function that accepts an array/vector as an input and calculate the sum of all the elements in the array. This function must use recursion to achieve this. Show code: Please show all steps.arrow_forwardPython languagearrow_forwardMULTIPLE FUNCTIONS AND RECURSIVE FUNCTIONS HANDS-ON use #include<stdio.h>arrow_forward
- # dates and times with lubridateinstall.packages("nycflights13") library(tidyverse)library(lubridate)library(nycflights13) Qustion: Create a function called date_quarter that accepts any vector of dates as its input and then returns the corresponding quarter for each date Examples: “2019-01-01” should return “Q1” “2011-05-23” should return “Q2” “1978-09-30” should return “Q3” Etc. Use the flight's data set from the nycflights13 package to test your function by creating a new column called quarter using mutate()arrow_forwardIn C write a grading program as follows.- Ask the user for the number of students and store it in an integer variable.- Create an array of floats with four rows and columns equal to the number of students storedearlier.- Initialize the array to zeros.Create a menu with the following options (use a do-while loop and repeatedly display the menu):A or a to add student info one student at a timeT or t to display class average for homeworkS or s to display class average for quizzesB or b to display class average for examsZ or z to exit program (program repeats until this exit command is entered)arrow_forward
- 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





