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
How do you define CONSTANT in C?
What are derived data types in c?
Why is it important to memset a variable, immediately after allocating memory to it ?
What does the characters “r” and “w” mean when writing programs that will make use of files?
What are dangling pointers in c?
What is string constants?
What happens if header file is included twice?
what are the advantages of a macro over a function?
Explain what is a static function?
How can I generate floating-point random numbers?
What is the function of volatile in c language?
List a few unconditional control statement in c.
Explain the difference between getch() and getche() in c?
Tell me with an example the self-referential structure?
Write a program, where i have a grid with many cells, how many paths are possible from one point to other desired points.