You are expected to work on your own Preferred visual studio, but you can use repl as well. • Must make sure to compile, build and run the code and program should be (a) compilation error free and (b) logical error free. • Must Validate the program with different types of data (both data arrangements and type of data). • Must attach the results along with your source code. Assignment: Write four different functions: a) void SelectionSort(Data "A, int N), where A is the array and N is number of data in the array. Data is the datatype, which you can declare first as a global declaration, by using typedef int Data; This helps by changing the datatype of the data to be sorted casily. b) int Min(Data *A, int start, int N); // this will return the index min, for the smallest data from the data set Afstart] to A[N-1] e) void InsertionSort(Data A, int N): d) void PrintArray(Data * A, int N), when called this function will display all the data in the array A Also, write the driver function (i.e. the main), main should do the following: i) Declare the array dynamically, so that memory can be used efficiently. To declare an array dynamically, the following steps may be used: • Declare a pointer of type Data Data * A: • Declare number of data N, and read a value for N • Allocate memory A= new Data (N] ii) Prompt the user to enter N number of data, and store those data in the array, by using a loop and cin statement to read the data. iii) Declare a variable sortType as integer and ask user to enter a value for sort Type.
You are expected to work on your own Preferred visual studio, but you can use repl as well. • Must make sure to compile, build and run the code and program should be (a) compilation error free and (b) logical error free. • Must Validate the program with different types of data (both data arrangements and type of data). • Must attach the results along with your source code. Assignment: Write four different functions: a) void SelectionSort(Data "A, int N), where A is the array and N is number of data in the array. Data is the datatype, which you can declare first as a global declaration, by using typedef int Data; This helps by changing the datatype of the data to be sorted casily. b) int Min(Data *A, int start, int N); // this will return the index min, for the smallest data from the data set Afstart] to A[N-1] e) void InsertionSort(Data A, int N): d) void PrintArray(Data * A, int N), when called this function will display all the data in the array A Also, write the driver function (i.e. the main), main should do the following: i) Declare the array dynamically, so that memory can be used efficiently. To declare an array dynamically, the following steps may be used: • Declare a pointer of type Data Data * A: • Declare number of data N, and read a value for N • Allocate memory A= new Data (N] ii) Prompt the user to enter N number of data, and store those data in the array, by using a loop and cin statement to read the data. iii) Declare a variable sortType as integer and ask user to enter a value for sort Type.
Chapter8: Arrays
Section: Chapter Questions
Problem 2RQ
Related questions
Question
Expert Solution
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 3 steps with 3 images
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
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage