At a shop of marbles, packs of marbles are prepared. Packets
are named A, B, C, D, E …….. All packets are kept in a
VERTICAL SHELF in random order. Any numbers of packets with
these names could be kept in that shelf as in this example:
bottom of shelf ---> [AAAJKRDFDEWAAYFYYKK]-----Top of shelf.
All these packets are to be loaded on cars. The cars are
lined in order, so that the packet could be loaded on them.
The cars are also named [A, B, C, D, E,………….]. Each Car
will load the packet with the same alphabet. So, for
example, car ‘A’ will load all the packets with name ‘A’.
Each particular car will come at the loading point only
once. The cars will come at the loading point in
alphabetical order. So, car ‘B’ will come and take all the
packets with name ‘B’ from the shelf, then car ‘C’ will
come. No matter how deep in the shelf any packet ‘B’ is,
all of the ‘B’ packets will be displaced before the ‘C’ car
arrives. For that purpose, some additional shelves are
provided. The packets which are after the packet B, are kept
in those shelves. Any one of these shelves contains only
packets, having the same name. For example, if any
particular shelf is used and if a packet with name X is in
it, then only the packets having names X will be kept in it.
That shelf will look like [XXXXXXX]. If any shelf is used
once, then it could be used again only if it is vacant.
Packets from the initial shelf could be unloaded from top
only. Write a program that finds the minimum total number
of shelves, including the initial one required for this
loading process.


No Answer is Posted For this Question
Be the First to Post Answer

Post New Answer

More C Interview Questions

write a program to interchange the value between two variable without using loop

1 Answers  


Difference between malloc() and calloc() function?

0 Answers  


WHAT IS THE DEFINATION OF IN TECHNOLOGY AND OFF TECHNOLOGY ?

1 Answers   IBM,


# define prod(a,b)=a*b main() { int x=2; int y=3; printf("%d",prod(x+2,y-10)); } the output of the program is a.8 b.6 c.7 d.none

7 Answers   Microsoft, TCS,


What is void pointers in c?

0 Answers  






Suppose I want to write a function that takes a generic pointer as an argument and I want to simulate passing it by reference. Can I give the formal parameter type void **, and do something like this? void f(void **); double *dp; f((void **)&dp);

1 Answers  


how to print this sereis 2 4 3 6 5..........?

3 Answers  


Are the variables argc and argv are always local to main?

0 Answers  


Which one to choose from 'initialization lists' or 'assignment', for the use in the constructor?

0 Answers  


What is modeling?

0 Answers  


4) Write a program that takes a 5 digit number and calculates 2 power that number and prints it.

5 Answers  


what are bitwise shift operators?

4 Answers  


Categories