0% found this document useful (0 votes)
39 views

Computer Programming Assignment

1) The document provides instructions for Assignment 1 for the Computer Programming course CS-103 at the National University of Computer and Emerging Sciences in Lahore. 2) Students are asked to write a C++ program with 7 functions: to input and output arrays, sort arrays using selection and insertion sort, merge sorted arrays, and remove repeated elements from an array. 3) The program must properly format code with comments and reusable functions to sort and merge integer arrays in both ascending and descending order without directly sorting the merged array.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views

Computer Programming Assignment

1) The document provides instructions for Assignment 1 for the Computer Programming course CS-103 at the National University of Computer and Emerging Sciences in Lahore. 2) Students are asked to write a C++ program with 7 functions: to input and output arrays, sort arrays using selection and insertion sort, merge sorted arrays, and remove repeated elements from an array. 3) The program must properly format code with comments and reusable functions to sort and merge integer arrays in both ascending and descending order without directly sorting the merged array.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Computer Programming (CS-103) FALL 2016

National University of Computer and Emerging Sciences, Lahore

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

You might also like