A LIFO (Last In, First Out) data structure.

learn more… | top users | synonyms

33
votes
4answers
67k views

Stack and Heap memory in Java

As I understand, in Java, stack memory holds primitives and method invocations and heap memory is used to store objects. Suppose I have a class class A { int a ; String b; ...
4
votes
5answers
1k views

Stack-instructions machines [closed]

When I look up "stack machine" I often get stuff like the JVM that uses a stack for data, but it still uses an array to store its instructions. I would like to find out more about machines whose ...
14
votes
6answers
5k views

Why do we need a Heap if everything can be done much more efficiently on the Stack?

This is actually somewhat related to the question I asked yesterday about why both a Stack and a Heap are necessary in the applications we use today (and why we can't just go with a Heap instead of ...
7
votes
8answers
15k views

What is the difference between an Array and a Stack?

According to Wikipedia, a stack: is a last in, first out (LIFO) abstract data type and linear data structure. While an array: is a data structure consisting of a collection of elements ...
5
votes
4answers
254 views

How to convert the following node evaluation procedure to a non recursive solution?

I have the following recursive method. It evaluates a node (that represent a logical expression), using deep first search traversal : EvaluateNode(Node node) { bool result; switch(node.Type) ...