Lab 9 Sorting




5/5 - (2 votes)

Lab 9

(10 pts) Sort the array and check prime numbers
Create a program which will sort an array of integers in ascending order using one of the sorting
algorithms we discussed in class (selection, insertion, or merge–NOT BUBBLE), and indicate whether
each integer element is a prime number.
(1 pt) Create a 1-D dynamic array of integers which is randomly filled with values between 1 and 100
(1 pt) Establish the length of the array based on user input
(1 pt) Error handle the user input to make sure it is a valid number greater than zero and less than or
equal to twenty-five
(1 pt) Print the elements of the array
(2 pt) Create a copy of the array and use your chosen sorting algorithm to sort it in ascending order
(1 pt) Print the elements of the sorted array
(1 pt) Print out all prime numbers of the array
(2 pt) End the program and make sure all memory has been freed (there should be no memory
Make sure your program is decomposed into appropriate functions which could be reused on other data
(5 pts) Assignment 5 Design
Show your TA some work towards your Assignment 5 design. Draw pictures of the relationships
between the classes and how the nodes are swapped, inserted, and deleted ( 2 pts ) . Write pseudocode
to describe the actions occurring in your drawing ( 3 pts ).