You are on page 1of 2

COMSATS University, Islamabad

Islamabad Campus
Department of Computer Science

Read before Attempt


Assignment No. 2: STACK AND QUEUE
Course code and Title: CSC211, Data Structure and Algorithm
Instructor: Tanveer Ahmed
Assigned Date: October 23, 2019 Due Date: November 6, 2019
Total Marks: --
CLO-2: Apply linear data structure to various practical problems.
Instructions:
1. This is an individual assignment. You will submit your work individually through your logins
(course portal)
2. Try to get the concepts, consolidate your concepts and ideas from these questions
3. You should concern recommended books for clarify your concepts as handouts are not
sufficient.
4. Try to make solution by yourself and protect your work from other students. If I found
the solution files of some students are same, then I will reward zero marks to all those
students.
5. Deadline for this assignment is November 6, 2019. This deadline will not be extended.

Question # 1 (Applications of Stack)


a) Convert the following infix expression into its equivalent postfix expression. Write each step of this conversion.
1. (A + B)*(C – D )
2. A ^ B * C – D + E/F
3. A/(B+C*D-E)
4. A-B*C+D/E
5. (A+B)^2 -(C-D)/2
Evaluate the postfix expression (part a) when:
A = 12 , B = 3 ,C = 7 , D = 4 ,E = 2 and F = 5
Question # 2
A priority Queue can be implement using following methods:
1. Using Array of Structure
Where array elements of priority queue can have the following structure:
struct data
{
int item;
int priority;
int order;
};

Spring 2019 Page 1


2. Using 2D Array
3. Linked List
Write algorithms for insertion, deletion and display for above implementation methods
Question # 3
A DEQUE is a data structure consisting of a list of items, on which the following operations are possible:
PUSH ( X,D) : Insert item X on the front end of DEQUE D.
POP(D) : Remove the front item from DEQUE D and return it.
Inject(X, D) : Insert item X on the rear end of DEQUE D.
Eject(D) : Remove the rear item from DEQUE D and return it.
Write algorithms for above operations.

Spring 2019 Page 2

You might also like