answersLogoWhite

0


Best Answer

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

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: When an element is pushed in a stack is it possible to push it at a particular index?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is an index in Java?

An index is basically a numeric association to an element in a collection of data.When you talk about an index in Java, you will most often be talking about the position of an object in an array.int[] numbers = new int[] {10, 20, 30, 40};Given the array declared above:numbers[0] = 10


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


Write a program in C plus plus to store 100 element within array and find the particular element if exist?

#include<iostream> #include<iomanip> #include<time.h> template<typename T> size_t find(T& data, T a[], size_t size) { size_t index=0; do { if(a[index]==data) break; } while(++index<size); return(index); } template<typename T> void print(T a[], size_t size) { using std::cout; using std::endl; using std::setw; size_t index=0; do{ if(index&&index%20==0) cout<<endl; cout<<setw(3)<<a[index]; }while(++index<size); cout<<endl; } int main() { srand((unsigned)time(NULL)); const size_t size=100; unsigned int a[size]; size_t index=0; do{ unsigned int data=rand()%100; do{ data=rand()%100; } while(find(data,a,index)<index); a[index]=data; } while(++index<size); print(a,size); }


What is an element in the Array?

An array is a container object that holds a fixed number of values of a single type. ... Each item in an array is called an element, and each element is accessed by its numerical index. As shown in the preceding illustration, numbering begins with 0. The 9th element, for example, would therefore be accessed at index 8.


C plus plus program for linear search non-recursive method?

#include#include#includevoid main(){int arr[100],i,element,no;clrscr();printf("\nEnter the no of Elements: ");scanf("%d", &no);for(i=0;i

Related questions

How do you find particular element in array?

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


What is the relationship between the value of the subscript and the value of the array element in c?

You can access the array-element via index (or subscript), but it is not possible the other way around.


What is an index in Java?

An index is basically a numeric association to an element in a collection of data.When you talk about an index in Java, you will most often be talking about the position of an object in an array.int[] numbers = new int[] {10, 20, 30, 40};Given the array declared above:numbers[0] = 10


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


If a CBT is stored using array , then what is the parent node of element stored at index 11?

In a complete binary tree (CBT) stored using an array, the parent of an element at index i can be found at index (i-1)/2, assuming the array is 0-indexed. So for an element stored at index 11, the parent node would be stored at index (11-1)/2 = 5.


What is the index of the third element of a vector is C plus plus?

Index 2. All subscripts are zero-based in C++ because the first element (at index 0) is offset 0 elements from the first element while the second (index 1) is offset 1 element from the start, and so on. Given a vector of n elements, the valid subscripts are in the range 0 through n-1.


When can you use index numbers?

When you are accessing an array's element.


Why in c plus plus index always start with 0?

C++ array indices are zero-based because the first element in any array is offset 0 elements from the start address. The second element is offset by 1 element and the third by 2 elements, and so on. To put it another way, the index refers to the number of elements that come before the desired element. The first element has zero elements before it, so it is index 0. For an array of n elements, the last element is at index n-1.


What is the Program to find the largest element in an array and position occurrence?

#include<stdio.h> #include<conio.h> main() { int a[100]; int n,largest,index,position; printf("enter the number of elements in the array"); scanf("%d",&n); printf("enter %d elements",n); for(index=0;index<n;index++) scanf("%d",&a[index]); largest=a[0]; position=0; for(index=1;index<n;index++) if(a[index]>largest) { largest=a[index]; position=index; } printf("largest element in the array is %d\n",largest); printf("largets element's position in the array is %d\n",position+1); getch(); }


How does one use an index future?

An index future is a "cash-settled futures contract on the value of a particular stock market index". Index futures are used in investments, trading, and hedging.


What is the purpose of the Russell 1000 Index?

The Russell 1000 Index is a stock market index. Its purpose is to represent the highest ranking 1000 stocks in the Russell 3000 Index, which counts for 90% of that particular market.


What is on index of American anthem book?

The alphabetical list of the subjects are what is on the index of the American anthem book. The index also has the references to the places where particular events took place or occurred.