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 is a static variable in c?
Explain what are linked list?
What is the difference between void main and main in c?
What kind of structure is a house?
What are runtime error?
What is the usage of the pointer in c?
write a program to create a sparse matrix using dynamic memory allocation.
Can you please explain the difference between strcpy() and memcpy() function?
Can we declare variable anywhere in c?
What is gets() function?
What is your stream meaning?
What does char * * argv mean in c?
How do you initialize pointer variables?
Write a program to reverse a string.
How arrays can be passed to a user defined function