Professional Documents
Culture Documents
Ice 2111
Ice 2111
Ice 2111
Section-A
(b) Write an algorithm to solve whether a string s has more vowels than consonants. 4
(c) Design an algorithm that takes two two-dimensional integer arrays and adds them component 5
wise.
Q.3 Consider the following Queue of characters, where Queue is allocated 6 memory cells.
CQ: C, D, F, K, __, __, __, __.
(a) Define circular queue with example. 1
(b) Illustrate the following operations: PUSH (Queue, B), PUSH (Queue, A), PUSH (Queue, E), 4
PUSH (Queue, T), POP (Queue, ITEM), POP (Queue, ITEM), POP (Queue, ITEM).
(c) Design algorithm for ENQUEUE and DEQUEUE to detect underflow and overflow of a 5
queue.
Section-B
1
(b) Consider the following tree and calculate tree traversal in inorder, preorder and postorder. 5
(b) Calculate a simple, connected, undirected, weighted graph with 8 vertices and 16 edges, each 5
with unique edge weights. Illustrate the execution of Kruskal’s algorithm on this graph.
(c) 𝟒
Suppose “1” is starting node, apply Breath First Search in graph shown above.
(b) Suppose an array A contains 8 elements as follows: A= {87, 43, 54, 21, 98, 32, 76, 65}. Apply 5
the selection sort algorithm to A.
(c) After sorting array “A” apply binary search algorithm to find out 99. 4