answersLogoWhite

0

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

Updated: 8/18/2019
User Avatar

Sudhir164208

Lvl 1
14y ago

Best Answer

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

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Define stack and how do you represent a stack and mention its applications?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you double the capacity of stack in c?

Something like this: before: #define MAXALLOC 256 after: #define MAXALLOC 512


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


Real time applications of stack?

The Most Best real time application is that the EXPRESSION EVALUATION


Define list of operation on stack?

There are 4 main widely used stack operations.Operations:* POP - increase stack pointer and return top element * PUSH - putting element into stack's top * TOP - returns data of top element on stack * LENGTH/SIZE - returns number of elements inside stack For more detailed implementation details, please check web links.


Is short stack awesome?

Yes! Yes! Yes! Not to mention if you don't like them then you are stranger than the strangest


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.


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.


Where string is stored on Heap or Stack in java?

A String is treated as an object, meaning there is an object on the heap. Of course, the variable you define is a pointer to the object, and it is stored on the stack.A String is treated as an object, meaning there is an object on the heap. Of course, the variable you define is a pointer to the object, and it is stored on the stack.A String is treated as an object, meaning there is an object on the heap. Of course, the variable you define is a pointer to the object, and it is stored on the stack.A String is treated as an object, meaning there is an object on the heap. Of course, the variable you define is a pointer to the object, and it is stored on the stack.


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 the use of .stack .data in starting lines of 8086 programming?

.STACK reserves bytes in RAM memory for the stack (the place where the processor will keep function calls and parameters)..DATABelow the ".DATA" line you should declare (and optionally define) your variables, so the compiler reserves the corresponding RAM for each of them.Data works differently from stack, as the data segment will keep named values (the variables values) while the stack will not. The stack will grow as needed upto the maximum value defined in the .STACK directive.


Is WhatsApp working on PC?

Download the Applications called Blue Stack Applits an androidemulatorheads up - it slows down the computer


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.