Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

What is a static variable in c?

1111


Explain what are linked list?

1041


What is the difference between void main and main in c?

1153


What kind of structure is a house?

1038


What are runtime error?

1128


What is the usage of the pointer in c?

1108


write a program to create a sparse matrix using dynamic memory allocation.

4888


Can you please explain the difference between strcpy() and memcpy() function?

1065


Can we declare variable anywhere in c?

966


What is gets() function?

1120


What is your stream meaning?

1227


What does char * * argv mean in c?

1053


How do you initialize pointer variables?

1092


Write a program to reverse a string.

1071


How arrays can be passed to a user defined function

1018