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
How can I recover the file name given an open stream or file descriptor?
What is static function in c?
general for is %wd,f-d; in this system "w" means a) 'w' represent total width of digits b) 'w' represent width which includes the digits before,after decimal place and the decimal point c) 'w' represent width which includes the digits before only d) 'w' represent width after decimal place only
Without Computer networks, Computers will be half the use. Comment.
How will you divide two numbers in a MACRO?
write a c program to print the next of a particular no without using the arithmetic operator or looping statements?
Describe how arrays can be passed to a user defined function
Where static variables are stored in c?
How can I display a percentage-done indication that updates itself in place, or show one of those twirling baton progress indicators?
What is infinite loop?
What is a const pointer?
How many types of functions are there in c?
What is use of pointer?
What does the c preprocessor do?
How can you avoid including a header more than once?