answersLogoWhite

0


Best Answer

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);

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you reverse the order of element on stack by using one additional stack and some additional non array variables?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is array indexing?

Unlike ordinary variables, the variables within an array do not have any names; they are anonymous. To access them you need to use memory offsets from the start of the array. Since the elements of an array are all the same type they are also the same length, thus the offsets are equal to the length of the array type. However, there is no need to calculate the offsets because each element's offset has a zero-based index. Thus the second element can be found at offset index 1.


What are Array variables also called as?

Elements of the array.


What is the need of array variables?

congugative memory allocation ,is use to array


What is the importance of array?

Arrays are important because we often need to work with a collection of variables of the same type and, particularly with large collections, it would be impractical to declare and name each one individually. With an array we don't have to name them because the variables are allocated in contiguous memory addresses and every element is the same length. Knowing only the start address of the array and the zero-based index of an element we gain constant-time random access to any element in the array. An array is really just an extension of a type. When we declare a variable of a given type we allocate sufficient memory to hold just one object of that type. With an array, we can allocate as many objects as we require.


Simple non-array variables are usually passed to methods by?

Simple non-array variables are usually passed to methods by value.


Will an array element be deleted when you retrieve it from the array?

You cannot delete from an array.


Why object array called universal array?

Object array is called universal array because it can store multiple variables of the same type


What is the difference between an array element and a variable?

Array elements are all members of the same variable, indexed in a logical manner. variables are distinct objects which must be referred to distinctly. The main functional difference is that a program can iterate over an array without the programmer knowing the original size of the array or explicitly which member to access.


How do you find particular element in array?

by using index position we can find the particular element in array.


Which element of array does this expression refer num5?

which element of the array does this expression reference num[5]


What is the index number of the last element of an array with 9 elements?

(array.length - 1) will find the index of the last element in an array (or -1 if the array is empty).


How do you represent binary tree using array?

The root of the tree is stored in array element [0]; for any node of the tree that is stored in array element [i], its left child is stored in array element [2*i], its right child at [2*i+2]