Q2
Reverse adjacent nodes in a linked list
Q3
Print the binary tree using Breadth First Traversal but reverse the elements of every nth breadth
![http://mathworld.wolfram.com/images/eps-gif/CompleteBinaryTree_1000.gif]
We need to print the tree using breadth first traversal but need to reverse the elements of every nth breadth from a provided starting point. I have used additional stack with queue to get the desired functionality. It will be more easier for users to understand the problem after running the code and seeing the output.
Q4
Discount on Pizza
Ans - let height be same for both pizza volume of 8" pizza is: pi * (8 * 8) * h, where h is height of pizza and pi is constant value = pi * 64 * h volume of 12" pizza is: pi * (12 * 12) * h, where h is height of pizza and pi is constant value = pi* 144 * h
so price of 12" pizza is - (pi * 144 * h * 3.99) / (pi * 64 * h) = 8.97 approx discount given - 8.97 - 6.73 = 2.24
so percentage of discount = 2.24 * 100 / 8.97 = 25 % approx
Q6
How to add two integers without using arithmetic operators?
Q7
check sign of two numbers
Given two signed integers, write a function that returns true if the signs of given integers are different, otherwise false. For example, the function should return true -1 and +100, and should return false for -100 and -200. The function should not use any of the arithmetic operators.
Q9
Print the Pascal triangle.
1 121 1331
Q10
Sting lower to upper case and vice versa