interview questions shared by candidates
Given a binary tree, how would you write program for getting mirror image of tree in O(n) time? Is it possible ? Assume you have no constraints on space.
if t is nul return; Mirror(Right) Mirror(Left) changeNodes(t)
//call mirror( root, img_root) //img_node is passed by reference mirror (node, img_node ): if (node == NULL) return img_node.left = node.right img_node.right = mode.left mirror (node.right, img_node.left) mirror (node.left, img_node.right)
Take a random sequence of bits and perform source coding using Huffman code. Write an optimization function for a 4 way traffic intersection, where vehicles are coming in from all directions. [Hint: Think cars as client in need of service arriving at an arrival rate and traffic light as the server process with a service rate] Drive the bit error rate of BPSK. Write a regular expression in Perl to search for a string pattern.( this was unexpected since I had told them I did not know perl ) How would you test a Modem if you get complaints from field about cell phones not working. Describe the test cases.