Professional Documents
Culture Documents
1 a Consider your mobile number as an array. Perform a Binary Search operation to find the number 8
5 in the array. Write the program and show the simulation steps.
[Hint: If your mobile number is 01723456789 then your array will be {0,1,7,2,3,4,5,6,7,8,9}]
b Consider the following stack, where STACK is allocated N=8 memory cells: 6
STACK: 1,5,3,8,9,0,11,--------
Describe the stack as the following operation take place:
i. PUSH ( STACK , 12)
ii. POP ( STACK , ITEM )
iii. PUSH ( STACK , 10 )
iv. PUSH ( STACK , 15 )
v. POP ( STACK , ITEM )
vi. PUSH ( STACK , 20)
vii. POP ( STACK , ITEM )
viii. POP ( STACK , ITEM )
ix. POP ( STACK , ITEM )
x. POP ( STACK , ITEM )
xi. POP ( STACK , ITEM )
xii. POP ( STACK , ITEM )
xiii. POP ( STACK , ITEM )
xiv. POP ( STACK , ITEM )
xv. POP ( STACK , ITEM )
2 a Write an algorithm for quick sort 12,45,56,78,90,32,66,55,11,44 elements of an array and show 5.5
what will happen in every pass.
b Compute the complexity of bubble sort algorithm for different scenario. 4
c Convert the following infix notation to respective prefix and post arithmetic notation 4.5
i. ((x*y)+z))
ii. ((x+y)*(z+t))
iii. ((x+y*z)-(u/v+w))
c What is hashing? What are the types of hashing? What are the properties if hash function? 6
4 a A file contains the following message with the frequencies as shown below. If Huffman Coding is 6
used for data compression, determine-
Message: AABACDEFCCDDBCEEFF