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 / abdur rab
The arrays are always sequential, since we are going to use
stack, ther is no possibility for random access.
PUSH all the values in the stack1, then pop the value from
stack1 into stack2.
so whenever ther is a PUSH to stack1, we need to POP all
the elements from stack2 to stack1 and then PUSH the new
value. Now POP all the values from stack1 to stack2. It ud
work like a queue then.
Is This Answer Correct ? | 4 Yes | 3 No |
Post New Answer View All Answers
Explain threaded binary trees?
Which is better between malloc and calloc?
What is the scope of local variable in c?
Why we use conio h in c?
Why C language is a procedural language?
What is file in c language?
Write a program to swap two numbers without using third variable?
A c program to display count values from 0 to 100 and flash each digit for a secong.reset the counter after it reaches 100.use for loop,. pls guys hepl me.. :(
What is mean by Data Driven framework in QTP? Can any one answer me in details on this regard.
What is the meaning of 2d in c?
What are types of preprocessor in c?
What are the 5 types of organizational structures?
How reliable are floating-point comparisons?
Explain what’s a signal? Explain what do I use signals for?
What are the 32 keywords in c?