answersLogoWhite

0

How do you represent a stack?

User Avatar

Nirajsharma4

Lvl 1
16y ago
Updated: 8/17/2019

A stack as in a software "pushdown stack" can be represented as an array with a count of how many elements are used. In JavaScript, you can simply initialize with A=[] and use A.push(newval) and A.pop() For example, type this in your browser's location box up top: javascript:a=[];a.push('i');a.push('h');alert(a.pop()+a.pop()) It puts h and then i on the stack, and then pops them off, in last-in-first-out (LIFO) order, and should say 'hi'. You can also represent a stack as a tree. An object store contains volatile (non-shared) objects and persistent (shared) objects. Both stacks contain references to objects. Non-algebraic operators act on the query result stack and the object store and affect the environment stack. Query evaluation takes the state of the environment stack and the state of the objects store and puts query results on the query result stack

User Avatar

Wiki User

16y ago

What else can I help you with?

Related Questions

What is a stack and how do you represent a stack in computer memory also discuss basic operation performed on a stack?

A stack is an abstraction of First-in-last-out, or the last in first out. The basic operations (may bear different names) Push or Add Pop or Next


What is stack sampling?

Stack sampling is a process of gathering representative samples of the gases (pollutants) in an industrial smoke stack to determine its composition. The physical environment in a stack is complex and stack sampling involves fair amount of physical modelling to ensure the gases samples represent the average gas composition in the stack. Stack sampling can also by done by passing a beam of light through the stack gases and observing the absorption spectra.


Represent a stack in c plus plus?

Use a vector with a base class type. Any objects derived from the base class can be pushed and popped from the vector just as you would from a stack.


What is purpose of BP in pointers registers?

The BP register is an index register that allow convenient access to arguments and local variable in the stack frame, because its use automatically selects the stack segment register. It is usually initialized with the value of the stack pointer at some point in the function routine, so that addresses above BP represent arguments and addresses below BP represent local variables.


Define stack and how do you represent a stack and mention its applications?

DEFINITION: A stack is a homogeneous collection of items of any one type, arranged li nearly with access at one end only, called the top. This means that data can be added or removed from only the top. Formally this type of stack is called a Last In, First Out (LIFO) stack. Data is added to the stack using the Push operation, and removed using the Pop operation. Representation- A stack as in a software "pushdown stack" can be represented as an array with a count of how many elements are used. In JavaScript, you can simply initialize with A=[] and use A.push(newval) and A.pop() For example, type this in your browser's location box up top: javascript:a=[];a.push('i');a.push('h');alert(a.pop()+a.pop()) It puts h and then i on the stack, and then pops them off, in last-in-first-out (LIFO) order, and should say 'hi'. You can also represent a stack as a tree. An object store contains volatile (non-shared) objects and persistent (shared) objects. Both stacks contain references to objects. Non-algebraic operators act on the query result stack and the object store and affect the environment stack. Query evaluation takes the state of the environment stack and the state of the objects store and puts query results on the query result stack Three applications of stack are 1) towers of hanoi 2)recurrsion 3)conversion of expression


If a short stack of paper represented a region of Earth's surface which fold or cut in the stack would show a monocline?

A monocline is a geological formation where rock layers are folded in a way that forms a single steep bend or slope in the Earth's crust. To represent a monocline with a stack of paper, you would fold the stack in a way that creates a single steep bend or slope in the layers, resembling the shape of a monocline. This could be done by gently pushing down on one side of the stack to create a steep angle or bend.


Why is stack pointer value 07h?

The stack pointer value of 07h typically indicates the current position of the stack in memory, often reflecting where the next data will be pushed or popped. In a system using hexadecimal notation, 07h corresponds to the decimal value of 7, which may represent a specific memory offset within the stack segment. This value can change dynamically during program execution as data is pushed to or popped from the stack. Ultimately, the stack pointer's value helps manage the call and return addresses, local variables, and function parameters in a program's execution context.


How could a stack of pictures be used to explain the law of superposition?

If the pictures are in order with the most recent on top, then the stack would represent the layers found in rock formations.


Why we use graphs?

To represent the data Graphs give a visual representation of progress (or regress) and they are much quicker and easier to grasp than a boring stack of numbers.


What is implicit stack?

A stack created by the user or a programmer is an implicit stack


What is the function of a stack pointer?

Stack pointer points to the topmost / most recently referenced location on the stack; - Nutan


How much in a stack?

$1000 in a stack