answersLogoWhite

0


Best Answer

Stack

User Avatar

Anonymous

Lvl 1
3y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: In what order the elements of a pushdown stack are accessed?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is the main difference between stack and array?

ArrayIt is a data structure that has group of same type elements in linear sequence. It requires continuous memory block to store it. Elements in Array is accessed by index. Array does not have any predefined functions.StackIt is a data structure that is a list of ordered elements. In most of the programming languages and computer architecture stack has limitation in size. Elements in stack might not be the same type. Stack has predefined functions: POP (get top element), PUSH (put element on top) and it works by LIFO(Last In First Out) principle. Elements from stack are removed in reverse order to the order of their addition.Example:POP 1;POP 2;POP 3;Stack: (top) 3 2 1 (bottom)PUSHPUSHPUSHWe get elements in this order: 3 2 1


How do you reverse the order of element on stack by using one additional stack and some additional non array variables?

You pop elements off of one stack and push them onto the other. This reverses the order of the elements. while ((element = pop(stack1)) != NULL) push(stack2, element);


An algorithm to Reversing the order of elements on stack S using 1 additional stacks?

// stack to contain content Stack sourceStack = new Stack(); // ... fill sourceStack with content // stack to contain reversed content Stack targetStack = new Stack(); while (!sourceStack.empty()) { targetStack.push(sourceStack.pop()); } // targetStack contains the reversed content of sourceStack


What is the operation of delete in stack?

Delete is mostly commonly known as pop in stack. The last element inserted into the stack is removed from the stack. Here is an illustration:Consider the stack with the elements 1,2,3,4 inserted in order.1->2->3->4\topThe top of the stack will be pointing to 4. When pop operation is performed, 4 is removed from the stack and the top is made to point to 3. The stack then becomes:1->2->3\top


Why filo is not used in stack?

FILO is an acronym of "first in last out". If we imagine a stack of plates, the first plate is at the bottom of the stack and is therefore the last to be removed from the stack. Thus FILO is used when referring to a stack. We use a stack when we wish to process elements in the reverse order they arrive, always processing the newest arrival first. Stacks are useful in backtracking algorithms and are a fundamental aspect of the call-and-return mechanism. FIFO, on the other hand, is an acronym of "first in first out" and is synonymous with "first come, first served". As such, FIFO applies to queues rather than stacks. We use a queue when we wish to process elements in the same order they arrive.

Related questions

What is the main difference between stack and array?

ArrayIt is a data structure that has group of same type elements in linear sequence. It requires continuous memory block to store it. Elements in Array is accessed by index. Array does not have any predefined functions.StackIt is a data structure that is a list of ordered elements. In most of the programming languages and computer architecture stack has limitation in size. Elements in stack might not be the same type. Stack has predefined functions: POP (get top element), PUSH (put element on top) and it works by LIFO(Last In First Out) principle. Elements from stack are removed in reverse order to the order of their addition.Example:POP 1;POP 2;POP 3;Stack: (top) 3 2 1 (bottom)PUSHPUSHPUSHWe get elements in this order: 3 2 1


How do you reverse the order of element on stack by using one additional stack and some additional non array variables?

You pop elements off of one stack and push them onto the other. This reverses the order of the elements. while ((element = pop(stack1)) != NULL) push(stack2, element);


An algorithm to Reversing the order of elements on stack S using 1 additional stacks?

// stack to contain content Stack sourceStack = new Stack(); // ... fill sourceStack with content // stack to contain reversed content Stack targetStack = new Stack(); while (!sourceStack.empty()) { targetStack.push(sourceStack.pop()); } // targetStack contains the reversed content of sourceStack


How do you represent a stack?

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


What is the operation of delete in stack?

Delete is mostly commonly known as pop in stack. The last element inserted into the stack is removed from the stack. Here is an illustration:Consider the stack with the elements 1,2,3,4 inserted in order.1->2->3->4\topThe top of the stack will be pointing to 4. When pop operation is performed, 4 is removed from the stack and the top is made to point to 3. The stack then becomes:1->2->3\top


Why filo is not used in stack?

FILO is an acronym of "first in last out". If we imagine a stack of plates, the first plate is at the bottom of the stack and is therefore the last to be removed from the stack. Thus FILO is used when referring to a stack. We use a stack when we wish to process elements in the reverse order they arrive, always processing the newest arrival first. Stacks are useful in backtracking algorithms and are a fundamental aspect of the call-and-return mechanism. FIFO, on the other hand, is an acronym of "first in first out" and is synonymous with "first come, first served". As such, FIFO applies to queues rather than stacks. We use a queue when we wish to process elements in the same order they arrive.


What are the important applications of stacks?

In computer science, a stack is an area of memory that holds all local variables and parameters used by any function, and remembers the order in which functions are called so that function returns occur correctly. Each time a function is called, its local variables and parameters are "pushed onto" the stack. When the function returns, these locals and parameters are "popped." Because of this, the size of a program's stack fluctuates constantly as the program is running, but it has some maximum size.One way of describing the stack is as a last in, first out (LIFO) abstract data type and linear data structure. A stack can have any abstract data type as anelement, but is characterized by two fundamental operations, called push and pop (or pull). The push operation adds a new item to the top of the stack, or initializes the stack if it is empty. If the stack is full and does not contain enough space to accept the given item, the stack is then considered to be in anoverflow state. The pop operation removes an item from the top of the stack. A pop either reveals previously concealed items, or results in an empty stack, but if the stack is empty then it goes into underflow state (It means no items are present in stack to be removed). A stack pointer is the register which holds the value of the stack. The stack pointer always points to the top value of the stack.A stack is a restricted data structure, because only a small number of operations are performed on it. The nature of the pop and push operations also means that stack elements have a natural order. Elements are removed from the stack in the reverse order to the order of their addition: therefore, the lower elements are those that have been on the stack the longest


Draw a neat sketch showing a pushdown stack memory machine and explain it?

WikiAnswers will not do your homework for you. Nor will it write your discussion paper, critiques, summaries or essays. That is considered cheating. If you have a specific question in the subject we are more than willing to help.


Write a program in c language to reverse elements of a queue?

There are many ways to reverse the order of the elements in a queue. Provided that you have access to the implementation of the queue, it is of course easy to read the elements from the tail end rather than the front end, thus reversing the elements. However, considering the queue as a black box, and assuming the queue only allows for its characteristic operations (removal of head element, addition to tail), the best method to reverse the elements in a queue to engage a stack. You'd remove the elements from the queue (always reading the head of the queue), and push each element onto the stack. When the queue is empty, you reverse that process: pop each element from the stack until it is empty, and add each element in this order to the end of the queue. Your queue will have the exact same elements as in the beginning, but in reverse order. The exact implementation of this in C, or in any other programming language, is trivial, but the exact source code depends on the implementation of queue and stack containers. Following is pseudocode: Queue<Item> reverse (Queue<Item> queue) { Stack<Item> stack; Item item; while (queue.remove(&item)) { stack.push(item); } while(stack.pop(&item)) { queue.add(item); } return queue; }


What is the application of stack in computer science?

A stack is a series of storage locations for data or instructions. These can be popped off the stack as needed, and pushed down onto the stack to be stored. They can be accessed in a LIFO or FIFO fashion.


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


When an element is pushed in a stack is it possible to push it at a particular index?

No, the whole idea of a stack is that elements can only be added at the top.