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

  • Home
  • SEARCH
  • 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 8936091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:08:22+00:00 2026-06-15T10:08:22+00:00

I think it would be a stack, but could it be a skip list,

  • 0

I think it would be a stack, but could it be a skip list, bst, or queue?

it makes sense for it to be a stack since we can keep pushing onto it and popping off. But would a queue be better since it adds them in the order they come in?

  • 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-06-15T10:08:24+00:00Added an answer on June 15, 2026 at 10:08 am

    You basically half-answered the question yourself: It makes sense to use a stack, since you can push and pop to/from a stack in the same order as the compiler would do it too, if you used recursion. Doing things the way people expect them to happen is a good thing (even if you can do them differently).

    A stack is also the easiest solution for the problem and the container with the least overhead, and the elements come out in the order that you usually want when doing recursion, without you needing to do anything special.

    In comparison, a queue has a lot more complexity since it has a head and a tail, and memory management is more complicated (a stack is basically just a chunk of memory and a pointer that is incremented/decremented).

    Also, when using a queue, elements come out in the order you pushed them in. This may not matter for some problems (e.g. if you just want to iterate every element once and don’t care about the order), but it makes it needlessly complicated to backtrack. For example, when recursively subdividing a block of data or recursively walking a tree, you will first recurse into the left half, then into the left half’s half, and so on.
    When you’ve reached the maximum depth, you will want to backtrack one level and recurse into the right half (and backtrack yet another level, and so on). With a stack, this is trivially done with a simple pop. With a queue, you must explicitly remember where to go. It is of course not impossible, but it’s not precisely trivial.

    You also mentioned skiplists. Note that a skiplist is not really something simple as a “list”, but a rather complicated structure, much more comparable to a search tree. It also is not a “natural choice” for the problem, and due to its complexity is most definitively not something you want to use for something like recursion (although if one is stubborn enough, it could probably be made to work).

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

Sidebar

Related Questions

I could never think it would be even challenging but is there any function
My problem is one that you would think is quite common, but I haven't
I am struggling trying to perform what I would think would be a relatively
So I have this idea for a RubyGem that I think would be an
The following code is an example of what I think would qualify as pseudocode,
You would think that launching a bat file from Java would be an easy
I think it would be easier to use function pointers if I created a
I think it would be fun to model a top view of a train
So you think it would be easy to find a direct example of POST
This should be pretty straightforward I would think. I have this string: [quote=Joe Johnson|1]Hi![/quote]

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.