Starting from:

$29.99

CS103 Assignment 4 Solution


Assignments to be completed during lab sessions
1. Implement a stack with an array. The maximum size of the stack is user input.
2. Implement a circular queue with an array. The maximum size of the queue is userinput.
struct book_t {
char *issn; /* A pointer to the ISSN number of the book. */
char *name;
}; struct student_t { /* A pointer to the name of the book. */
int roll; /* The roll no of the student. */
char *name;
}; /* A pointer to the name of the student. */
4. Write a function to evaluate a postfix expression. An operand could be any elementin the set {0,1,2, . . . ,9}. A operator could be any element in the set {+, −, ∗, /, ∧}.
5. Implement a stack with a circular doubly linked list that contains information aboutthe first (head) node only. Now, implement a queue with two instances of the stack.
6. Implement a queue with a circular singly linked list that contains information aboutthe first (head) node and the last (tail) node. Now, implement a stack with two instances of the queue. Reverse a string using the stack.
Additional assignments
1. Consider the following two structures.
Implement a generic singly linked list so that you can store a pointer to either of book t and student t in any node of the list with the following four operations defined on the list: (i) insert an element at the ith location of the list, (ii) delete the element from the ith location of the list, (iv) get the element at the ith location of the list, (iv) find the length of the list, (v) a generic print function that prints each element of the list, and (vi) a generic sort function that can sort the list using any of the member variables of the above two structures. Now, Consider a library management system. Say, there are b different books (book t) and s number students (student t). Create a list of books and a list of students. Sort and print both the lists using ukey and roll, respectively.
2. Implement two stacks in an array.
3. Rewrite all the programs associated with linked lists both in Assignment-II and inAssignment-III, such that, the implementations contain information about the first (head) node and the last (tail) node.

More products