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 860635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T08:50:44+00:00 2026-05-15T08:50:44+00:00

When talking about a stack in either computing or real life we usually assume

  • 0

When talking about a stack in either computing or “real” life we usually assume a “first on, last off” type of functionality.

Because the idea of a stack is based around something in the physical world, does it matter how the data in the stack is stored?

I notice in a lot of examples that the storage of the stack data is quite often done using an array and the newest item added to the stack is placed at the bottom of the array. (like adding a new plate to an existing stack of plates except putting it underneath the other plates rather than on top).

As a paradigm, does it matter in what order the data is stored within the stack as long as the operation of the stack acts as expected?

  • 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-15T08:50:44+00:00Added an answer on May 15, 2026 at 8:50 am

    It doesn’t matter how your store your data in memory as long as the functionality and performance are as expected.

    Often stacks are implemented as an array with a size and capacity where the size is the number of elements currently in the stack and the capacity is the maximum number that can be stored without requiring a relatively expensive memory reallocation.

    The capacity typically doubles when required to give amortized O(1) performance for insertion. It is generally easier to implement the stack with the empty space at the high index end of the array, so this is what is typically done.

    To give a specific example, the current top of the stack can be stored as the index into the array of the top element. If the items were added to the highest index of the array downwards then when the array is increased to make room for more elements the index of the top of the array would also change. When filling from the bottom the index of the top element does not change when the array needs to be resized.

    If you wanted to implement your stack differently, you could do that, just make sure that the functionality and performance of your implementation are documented.

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

Sidebar

Ask A Question

Stats

  • Questions 536k
  • Answers 536k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer There are reliable ways of determining the size of an… May 17, 2026 at 1:17 am
  • Editorial Team
    Editorial Team added an answer We often choose to use a Windows Service. For recurring… May 17, 2026 at 1:17 am
  • Editorial Team
    Editorial Team added an answer If your first section of that file is commented out,… May 17, 2026 at 1:17 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

When writing comments, I sometimes find myself needing to talk about a type (class,
I've learned that you should usually stick with either forking or threading to avoid
Background: Professional tools developer. SQL/DB amateur. Setup: .Net 3.5 winforms app talking to MS
I'm revisiting my class tracking (dirty logic), which I wrote last year. Currently I
I'm in a bit of a pickle. I need to generate charts (off screen
When designing a database to use MVCC (Multi-Version Concurrency Control), you create tables with
I've got a desktop program. Most Operating Systems run the program in its own
Lately, I've decided to start using Perl::Critic more often on my code. After programming
I'm pretty new to the Objective-C world and I have a long history with
I'm working on designing the kernel (which I'm going to actually call the core

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.