-
Given a stack S, write a C program to sort the stack (in the ascending
order).
We are not allowed to make any assumptions about how the stack is implemented.
The only functions to be used are:
Push
Pop
Top
IsEmpty
IsFull
-
Given a linked list, your are asked to find out the nth last element in
the linked-list. (n would be given as the argument to the function)
-
The numbers are represented in linked-list with each node representing a
digit of the number as follows:
123 == 1 2 3 NULL
999 == 9 9 9 NULL
Write a C program to add two numbers.
I/P : 9 9 9 NULL
1 NULL
O/P : 1 0 0 0 NULL
You can assume that the number of elements in the linked-list is available
to you.
struct List
{
Node* head;
int noe; /* number of elements */
};
-
There is a 100-story building and you are given two eggs.
The eggs (and the building) have an interesting property that
if you throw the egg from a floor number less than X, it will not
break. And it will always brake if the floor number is equal or greater than X.
Assuming that you can reuse the eggs which didn't broke, you got to find
X in a minimal number of throws.
Give an algorithm to find X in minimal number of throws.