DS Prorating Assignment III Semester
DS Prorating Assignment III Semester
Tech
Data Structures (CSE 2122)
Assignment Questions for Prorating
Note: If a student missed any ONE of the components of IA for a genuine reason, he/she has to submit
an assignment by answering the first THREE questions, and if he/she missed any TWO components of
IA for a genuine reason, then he has to submit an assignment for all FIVE questions. (Submission is
hand-written hard copy to the respective faculty on or before 7th November 2024)
Questions:
1. Solve the problem of sorting one-dimensional arrays using a C program. Write a C program that
reads integers from the keyboard and places them in an array. The program then sorts the array into
ascending and descending order and prints the sorted lists. The program must not change the
original array or create any other integer arrays. [Hint: Use an array of pointers]
2. Outline an algorithm to convert a prefix expression to a postfix expression. Apply the same
algorithm to convert the expression + * + A * - B C D E F to its postfix form by showing the steps
involved:
3. Consider an Organizational chart given below, which represents the organizational structure of a
company. Write a program to represent the chart using an efficient data structure. For each
employee, the name of the employee and designation must be recorded. The program should also
print all the employees with a given designation.
4. Write a C program(Menu driven) to implement ‘n’ stacks using a single 1-D array containing ‘m’
locations with the following prototypes: i) push(int i, int item, STACK *S); //pushing an item on
ith stack ii) pop(int i, STACK *S);//poping an item from ith stack iii) display(S) // displaying all ‘n’
stack contents For the STACK structure, the members boundary[i] and top[i] represents boundary
and top respectively for the ith stack along with element represented by other members. While
pushing if the particular stack is full, and if there is space available elsewhere in the array of ‘m’
locations, it should shift the stacks so that space is allocated to the full stack.
5. Write a complete C program consisting of a function sortedInsert(. . .) to insert an integer into a
sorted doubly linked list, such that after insertion, the list remains sorted. Also, include function to
display the contents of the list