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

what is the difference between arrays and linked list

26 Answers   MAHINDRA, Tech Mahindra, Wipro,


write a program to swap bits in a character and return the value prototype of function char fun (char a, charb flag c) where fun returns a char, char a is a the value char b is the bit to be changed and flag c is the bit value for eg: x=fun(45,7,0) since 45 is 0010 0101 and ow x should contain the value 65 (0110 0101)

1 Answers   Bosch, College School Exams Tests,


What is the memory allocated by the following definition ? int (*x)();

2 Answers   ADITI,


hOW Can I add character in to pointer array of characters char *a="indian"; ie I want to add google after indian in the char *a

1 Answers  


Can you please explain the difference between malloc() and calloc() function?

0 Answers  






What is the explanation for cyclic nature of data types in c?

0 Answers  


What are examples of structures?

0 Answers  


The program will first compute the tax you owe based on your income. User is prompted to enter income. Program will compute the total amount of tax owed based on the following: Income Tax 0 - $45,000 = 0.15 x income $45,001 - $90,000 = 6750 + 0.20 x (income – 45000) $90,001 - $140,000 = 15750 + 0.26 x (income – 90000) $140,001 - $200,000 = 28750 + 0.29 x (income – 140000) Greater than $200,000 = 46150 + 0.33 x (income – 200000) Dollar amounts should be in dollars and cents (float point numbers with two decimals shown). Tax is displayed on the screen.

0 Answers   Microsoft,


In cryptography, you could often break the algorithm if you know what was the original (plain) text that was encoded into the current ciphertext. This is called the plain text attack. In this simple problem, we illustrate the plain text attack on a simple substitution cipher encryption, where you know each letter has been substituted with a different letter from the alphabet but you don’t know what that letter is. You are given the cipherText as the input string to the function getwordSets(). You know that a plain text "AMMUNITION" occurs somewhere in this cipher text. Now, you have to find out which sets of characters corresponds to the encrypted form of the "AMMUNITION". You can assume that the encryption follows simple substitution only. [Hint: You could use the pattern in the "AMMUNITION" like MM occurring twice together to identify this]

0 Answers   Infosys,


Write a program in c using only loops to print * * * * * *******

2 Answers   IBM,


Explain the binary height balanced tree?

0 Answers  


What are the commands should be given before weiting C Program i.e, Cd.. like

4 Answers   IBM, Infonet, Satyam, Tech Mahindra,


Categories