Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6793913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:09:31+00:00 2026-05-26T18:09:31+00:00

A language has not array as a data type but it has stack as

  • 0

A language has not array as a data type but it has stack as a data type and one can declare stack’s; and push, pop and isempty operations are defined.
So how can we implement array using two stacks and above operations?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T18:09:31+00:00Added an answer on May 26, 2026 at 6:09 pm

    Horribly inefficient – but:

    Stack 1 Contains the details
    Stack 2 is empty.

    To go through the array, Pop Stack 1 , when you want the next one, push the previous one into stack 2 and pop stack 1 again. Repeat until ‘isempty’.

    If you want the Nth value, pop the not empty stack N times while pushing the unneeded ones into the other stack. Then when you’re done playing with it, empty it into the other stack. Note that this;ll flip the order.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need a simple parser generator. The language does not matter. It only has
Python language has a well known feature named interactive mode where the interpreter can
If a language has control structures and variables, but no support for arrays, lists,
Everyone (at least everyone who uses a compiled language) has faced compilation errors but
PHP has a language construct list() which provides multiple variables assignment in one statement.
Every language has a random() function or something similar to generate a pseudo-random number.
My project (an interpreted language) has a standard library composed by multiple files, each
The use of XSLT (XML Stylesheet Language Transform) has never seen the same popularity
I need to pass a pointer through a scripting language which just has a
Jquery has a great language construct that looks like this: $(document).ready(function() { $(a).click(function() {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.