Adobe Placement Paper - 4


1) Write a program to reverse a linked list and sort the same.
2) Given two integers a & b. Determine how many bits required to convert a to b. Write a function int bits Write a program reqd(int a, int b);
3) write an algorithm to insert a node into sorted linked list. After inserting, the list must be sorted.
4) without using /,% and * operatoRs. Write a function to divide a number by 3.itoa() function is available.
5) Write a program to swap two integer pointers.
6) write a funcn int round (float x) to round off a floating point num to int.
7) write an alp to find sum of first n natural numbers using the following instructions
lda num ; load accumulator with num
dcr r ; decrement register r
inr r ; increment register r
mov x,y ; move the contents of register y into register x
jz label ; jump to label if a=0
djnz label; decrement & jump if a <> 0 you can use b & c registers in addition to a register
8) prove that a tree is bst. What is height of a tree?
9) Given a, b & c boolean polynomials. Prove that (a+bc) = (a+b) (a+c)