Consider a language that does not have arrays but does have
stacks as a data type.and PUSH POP..are all defined .Show
how a one dimensional array can be implemented by using two
stacks.
Answer Posted / barun
In one stack keep values and in another stack keep index of
array. In other wards a[0] = 10. Then keep in bottom of
stack1 value 10 and in bottom of stack2 0. Both needs to be
synchronized in such implementation. Of course random access
is not possible.
| Is This Answer Correct ? | 6 Yes | 2 No |
Post New Answer View All Answers
What’s a signal? Explain what do I use signals for?
What does. int *x[](); means ?
What is the general form of #line preprocessor?
What is a program flowchart?
what is the function of pragma directive in c?
What is the c value paradox and how is it explained?
The difference between printf and fprintf is ?
How many types of arrays are there in c?
What are the advantages and disadvantages of a heap?
What are the 5 data types?
Given only putchar (no sprintf, itoa, etc.) write a routine putlong that prints out an unsigned long in decimal. [ I gave the obvious solution of taking % 10 and / 10, which gives us the decimal value in reverse order. This requires an array since we need to print it out in the correct order. The interviewer wasn't too pleased and asked me to give a solution which didn't need the array ].
Write a program for Overriding.
will u please send me the placement papers to my mail???????????????????
What is bin sh c?
What is the difference between mpi and openmp?