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


Please Help Members By Posting Answers For Below Questions

hi folks i m approching for h1 b interview on monday 8th of august at montreal and i m having little problem in my approval notice abt my bithdate my employer has made a mistake while applying it is 12th january and istead of that he had done 18 the of january do any body have any solution for that if yes how can i prove my visa officer abt my real birthdate it urgent please let me know guys thaks dipesh patel

1611


Differentiate call by value and call by reference?

734


What does sizeof return c?

792


Write a function that will take in a phone number and output all possible alphabetical combinations

796


How will you print TATA alone from TATA POWER using string copy and concate commands in C?

1137






Is c object oriented?

703


What are the types of unary operators?

858


A collection of functions,calls,subroutines or other data a) library b) header files c) set of files d) textfiles

874


is it possible to create your own header files?

809


What is the return type of sizeof?

797


What language is lisp written in?

819


What is sizeof array in c?

751


Explain the advantages of using macro in c language?

750


What are the advantages of external class?

779


What is the deal on sprintf_s return value?

818