Computer Programming Assignment
Computer Programming Assignment
Section A, B
Assignment # 1
Pointers, Dynamic 1-D Arrays
Submission Dead Line: Friday 9/10/2016
WRITE STRUCTURED CODE WITH SEPARATE AND REUSEABLE FUNCTIONS FOR
ALL OPERATIONS
PROVIDE PROPER INDENTATION AND COMMENTS WITH YOUR CODE
Question 1:
Write a C++ program with following functions.
1. Input: will take size and data of two integer arrays X and Y as input from user.
2. Output: This function will output the data of dynamic array.
3. Selection_ Sort: The data in X must be sorted in ascending order and data of array Y must be
sorted in descending order using selection sort.
4. Merge_ Ascending: This function will merge data of X and Y in a new array Z in ascending
order. Pass all three arrays X, Y, Z and their sizes as parameters to merge function.
5. Insertion_ Sort: The data in X and Y must be sorted in descending order using insertion sort.
6. Merge_ Descending: This function will merge data of X and Y in a new array Z in descending
order. Pass all three arrays X, Y, Z and their sizes as parameters to merge function.
Note: You cannot use any sorting algorithm for array Z in both merge functions.
7. Remove_ Repetition: This function will take an array and its size as parameter, then finds and
removes all repeated elements from array. It should update the size of array accordingly.
Happy Programming