Course Title: Data Structure and Algorithm
Total Marks: 40
Time allowed: 1 Hour
Question No. 1 (10 Marks)
- Write an algorithm to sort a given data in Ascending Order by selection sorting
- Write an algorithm to sort a given data in Ascending Order by Bubble sorting
data: 6, 8, 54, 2
Question 2: (20 Marks)
- Consider the following operation performed on a stack of size 10:
push(a),pop( ),push(b), push(c),pop(),push(d),pop(), pop( ), push (d)
which of the following statement is correct
- a) overflow b)underflow c)both a & b d) none
Note: (show the implementation graphically)
- If the sequence of operation are push(1), push(2), pop(),push(1), push(2),pop( ),
pop( ), pop(), push(2), pop( ) are performed on stack, the sequence of poped out values
- a) 2,2,1,1,2 b) 2,2,1,2,2 c) 2,1,2,2,1 d) 2,1,2,2,2
Note: (show the implementation graphically)
Consider the infix expression.
(4+8)*(6-5)/((3-2)*(2+2))
- Convert the expression to postfix
- Evaluate the postfix expression using stac
Consider the infix expression.
(4+8)*(6-5)/((3-2)*(2+2))
- Convert the expression to postfix
- Evaluate the postfix expression using stac
Consider the infix expression.
(4+8)*(6-5)/((3-2)*(2+2))
- Convert the expression to postfix
- Evaluate the postfix expression using stac
Consider the infix expression.
(4+8)*(6-5)/((3-2)*(2+2))
- Convert the expression to postfix
- Evaluate the postfix expression using stac
Question 3: (10 Marks)
+ | – | 1 | * | 122 | 123 |
Write a C++ program to display all elements using in array using Linear Queue data structure.