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

Home Assignment On Arrays

The document describes two programming problems. Problem 1 asks to write a program to find the mode (number that occurs most frequently) in an array of integers. The input will be the array size and integer elements, and the output should print the mode(s) and number of occurrences. Problem 2 asks to merge two sorted integer arrays into a single sorted array, maintaining ascending order. The input will be the sizes and elements of the two arrays, and the output should print the merged sorted array. Submission guidelines require creating a folder named with student ID, renaming code files as "studentID_problem#.c", copying only .c files to the folder, and compressing to a .zip file for upload.

Uploaded by

Ramima Mumtarin
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Home Assignment On Arrays

The document describes two programming problems. Problem 1 asks to write a program to find the mode (number that occurs most frequently) in an array of integers. The input will be the array size and integer elements, and the output should print the mode(s) and number of occurrences. Problem 2 asks to merge two sorted integer arrays into a single sorted array, maintaining ascending order. The input will be the sizes and elements of the two arrays, and the output should print the merged sorted array. Submission guidelines require creating a folder named with student ID, renaming code files as "studentID_problem#.c", copying only .c files to the folder, and compressing to a .zip file for upload.

Uploaded by

Ramima Mumtarin
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Problem #1 (10 marks)

Mode Finding
Write a program that will find the mode in an array of integers. The mode of an array of numbers
is the number that occurs maximum times in the array. You will first input the number of
integers, ​n (1<=​n​<=100) in the array. It will be followed by ​n ​integers that are the elements of
the array. All the integers will be in the range 1 to 1000. Your program will then output the
mode(s) of the array of integers along with the number of times it occurs in the array. If there are
more than one mode, you have to print all the modes in separate lines.

Sample Input(s) Corresponding Output(s)

9 53
112344555

5 11
12345 21
31
41
51

Problem #2 (10 marks)


Array Merge
Write a program to merge two ​sorted arrays of integers into a single array of ​sorted ​integers in
ascending ​order. The input sequence will be as follows. The number of elements in the first
array, ​m​, followed by ​m integers that are the elements of the first array. The integers will be
sorted either in ascending or descending order. The next input will be the number of elements in
the second array, ​n​, followed by ​n integers of the second array sorted in either ascending or
descending order. Note that the two input arrays need not be sorted in the same order, i.e.,
elements of one array can be given in ascending order while the other may be in descending
order (see test case# 2 in sample input-output table). Your program will then ​merge the two
arrays in the first array in ascending order​. You are not allowed to declare additional
temporary arrays for internal processing, i.e, you have to do all the processing with the two input
arrays. Finally your program will ​print the first array which will now contain ​m+n ​elements
sorted in ascending order.

Sample Input(s) Corresponding Output(s)

4 12334456789
3457
7
1234689
5 1122334455
54321
5
12345

Submission Guideline:

Strictly maintain the following submission guideline.

1. First create a folder and rename it with your student id, for example, 1906001 (Most
Important).

2. Rename your .c files using "studentID_problemNo.c" format ( for example, if there are two
problems, then 1906001 will rename the files as 1906001_problem1.c and
1906002_problem2.c). Then, copy only .c files (do not copy .exe or any other type files) of the
assignment inside the folder created in the previous step.

3. Now compress the folder in .zip format and upload the .zip file.

** Do not upload any .rar file. Do not miss point 1. Do not use your name or assignment number
as the folder name.

You might also like