• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

info on stack structure

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello!
could someone help me out a little, i have to dig up information on Stack structure..ir its features and its main operations...
where can i find this kind of information??
or could some1 who knows a lot help me out???
thanks!!
ahhh, another question i have to answer is about run-time activation record stack?
my text book is not that good.....thanks!!!
 
Bartender
Posts: 1843
Eclipse IDE Ruby Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A stack is simply an ordered collection of objects in which only the "top" object is accessable.
You can add an object to the stack, making that object the new "top" object. This is called "pushing."
You can remove the "top" object from the stack, revealing the next object as the "top" object. This is called "popping."
The easiest way to envision this is a stack of playing cards. You start with an empty stack. Then push the Ace of diamonds onto the stack (lay it face up on the table.) Push the Three of Clubs onto the stack (put the Three down overtop the Ace; only the Three is visible). Push the Queen of Hearts onto the stack. Now, pop off the Queen. The Three is now the "top" card. Push the Jack of Spades. etc.
This is usually/most easily implemented as a List that prevents access to any object but the first. The class usually defines a "void push(Object)" and an "Object pop()" method; an "Object view()" is optional but useful (This would look at the top object without removing it from the stack- essentially, a call to "get(0)").
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also, in my experience, Stacks often provide an isEmpty() or empty() method to let the user know whether the Stack is empty.
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For the Stack sample code.
For Stack trace tutotrial
Amit Gulhane
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic