I have a problem with a coding assignment and am becoming clueless as to how to solve it.
I am working with PGM images and I have read the data and saved it into a buffer (2D array ex. data[width][height])
I have been asked to then transfer that data into an array of 2d arrays of size 8x8 for the 2d arrays and the number of arrays is width*height/64.
How would I go about storing the data from the 2D buffer into the array of 8x8 2D arrays?
Write a program to take as input an array of N names, an array of N ids and an array of N salaries where the name, id, and salary of the 饾憱 th index belongs to the same person. Store them in a structure and sort them according to salaries (ascending) and then by ids (ascending). Print the person in the sorted order.
Sample input:
5
Mr. Kamal
Ms. Zara
Nitu Roy
Rakib Hasan
Samira Haque 32 28 29 25 30
165 163 165 178 165
Sample output :
Ms. Zara 163 28
Nitu Roy 165 29
Samira Haque 165 30
Mr. Kamal 165 32
Rakib Hasan 178 25
Write a program to take as input the name, height in cm and age of n employees, and
sorts it according to height in descending order. If two employees have the same height, then it sorts
according to age in descending order. Print the employees in the sorted order.
Sample input:
5
Mr. Kamal
165 32
Ms. Zara
163 28
Nitu Roy
165 28
Rakib Hasan
178 25
Samira Haque
165 28
Sample output:
Rakib Hasan 178 25
Mr. Kamal 165 32
Nitu Roy 165 28
Samira Haque 165 28
Ms. Zara 163 28
2. Vishal is having a bunch of coins ranging from rupees 1 to 10. Help him to write program to find the sum and average of the coins that he is having using while loop.
Solution:聽
Write a program to implement the Merge sort algorithm with the space optimization for
auxiliary space O(n/2).
Write a program for Linked-list implementation of a complete binary tree. The program must
have the following functionalities.
a) Insert(): inserts a new ITEM to the complete binary tree. The items are of integer type.
b) Height(): returns height of a node recursively. Height (N) = MAX(Height(L), Height(R))
+ 1. Here, L and R respectively represent the Left child and Right child of node N. Height
of a leaf node is 0.
c) Preorder(): returns the preorder traversal sequence of the binary tree. Use recursive
implementation.
d) Postorder(): returns the postorder traversal sequence of the binary tree. Use recursive
implementation.
by聽CodeChum Admin
Now this one's a tad bit tricky, but you can definitely do it!
Instructions:
Input
1. First integer
2. Second integer
3. Third integer
4. Fourth integer
5. Fifth integer
Output
The first five lines will contain message prompts to input the five integers.
The line contains the result.
Enter路integer路1:路2
Enter路integer路2:路3
Enter路integer路3:路3
Enter路integer路4:路5
Enter路integer路5:路4
Result路=路2560000Write a program that allows the user to enter the coal usage at a power station for the first and second week of October in metric tonnes which is as follows:
Week 1: 29,31,29,30,30,28,35
Week 2: 33,37,28,32,31,30,32
Write a program to implement 2 Stacks in a single array of size N. The stacks
should not show overflow if there even a single slot available in the array. Write
the functions popA(), popB(), pushA(), pushB() for pushing and popping from
these stacks.
WAP to implement a stack using one queue.