网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
A push operation adds an item to the top of a (73).
A.queue
B.tree
C.stack
D.date structure
B.tree
C.stack
D.date structure
参考答案
参考解析
解析:推动操作将项目添加到____顶部。A 线性表B树状图 C栈 D数据结构栈(stack)又名堆栈,它是一种运算受限的线性表。其限制是仅允许在表的一端进行插入和删除运算。这一端被称为栈顶,相对地,把另一端称为栈底。向一个栈插入新元素又称作进栈、入栈或压栈,它是把新元素放到栈顶元素的上面,使之成为新的栈顶元素;从一个栈删除元素又称作出栈或退栈,它是把栈顶元素删除掉,使其相邻的元素成为新的栈顶元素。
更多 “A push operation adds an item to the top of a (73).A.queue B.tree C.stack D.date structure ” 相关考题
考题
试题(10)—(11)基于以下描述:有一个初始为空的栈和输入序列 A、B、C、E、F、G:现发过如下操作:push, push, top, pop, push, push,top, push, pop, pop, pop.(10)下列哪一个是正确的从栈中删除元素的序列?A)BEB)BDC)BEDCD)BDEC
考题
●试题七阅读以下说明和C++程序,将应填入(n)处的字句写在答题纸的对应栏内。【说明】以下程序的功能是设计一个栈类stackT,并建立一个整数栈。【程序】#includeiostream.h#includestdliB.hconst int Max=20;∥栈大小templateclass Tclass stack{∥栈元素数组T s[Max];∥栈顶下标int top;public:stack(){top=-1;∥栈顶初始化为-1}void push(const T &item);∥item入栈T pop();∥出栈int stackempty()const;∥判断栈是否为空};templateclass Tvoid stackT::push(const T &item){if(top== (1) ){cout"栈满溢出"endl;exit (1) ;}top++;s[top]=item;}templateclass TT stackT::pop(){T temp;if(top== (2) ){cout″栈为空,不能出栈操作″endl;exit (1) ;}temp=s[top];top--;return temp;}templateclass Tint stackT::stackempty()const{return top==-1;}void main(){stackintst;int a[]={1,2,3,4,5 };cout"整数栈"endl;cout"入栈序列:"endl;for(int i=0;i4;i++){couta[i]" ";(3) ;}coutendl"出栈序列:";while( (4) )cout (5) " ";coutendl;}
考题
第 ( 10 ) - ( 11 ) 题基干以下描述 : 有一个初始为空的栈和下面的输入序列 A,B,C,D,E,F ; 现经过如下操作: push, push, push, top, pop, top, pop, push, push, top, pop, pop, pop, push 。( 10 )下列哪一个是正确的从栈中删除元素的序列?A ) CBEB ) EBDC ) BEDCAD ) CBEDA
考题
阅读以下说明C++代码,将应填入(n)处的字句写在对应栏内。[说明]以下程序的功能是实现堆栈的一些基本操作。堆栈类stack共有三个成员函数:empty判断堆栈是否为空;push进行人栈操作;pop进行出栈操作。[C++程序]include "stdafx. h"include <iostream, h>eonst int maxsize = 6;class stack {float data[ maxsize];int top;public:stuck(void);~ stack(void);bool empty(void);void push(float a);float pop(void);};stack: :stack(void){ top =0;cout < < "stack initialized." < < endl;}stack:: ~stack(void) {cout < <" stack destoryed." < < endl;bool stack:: empty (void) {return (1);void stack: :push(float a)if(top= =maxsize) {cout < < "Stack is full!" < < endl;return;data[top] =a;(2);}float stack:: pop (void){ if((3)){cout< < "Stack is undcrflow !" < < endl;return 0;(4);return (5);}void main( ){ stack s;coat < < "now push the data:";for(inti=l;i =maxsize;i+ +) {cout< <i< <" ";s. push(i);}coat < < endl;cout< < "now pop the data:";for(i = 1 ;i < = maxsize ;i + + )cout< <s. pop()< <" ";}
考题
有如下程序: nclude using namespace std; class Stack{
有如下程序: #nclude<iostremn> using namespace std; class Stack{ public: Stack(unsigned n=10:size(n){rep_=new int[size];top=O;} Stack(Stacks):size(s.size) { rep_=new int[size]; for(int i=0;i<size;i++)rep_[i]=s.rep_[i]; top=s.top; } ~Stack(){delete[]rep_;} void push(int a){rep_[top]=a; top++;} int opo(){--top;return rep_[top];} bool is Empty()const{return top==O;} pavate: int*rep_; unsigned size,top; }; int main() { Stack s1; for(int i=1;i<5;i++) s1.push(i); Stack s2(s1); for(i=1;i<3;i++) cout<<s2.pop()<<','; s2.push(6); s1.push(7); while(!s2.isEmpty()) cout<<s2.pop()<<','; return 0; } 执行上面程序的输出是A.4,3,2,1B.4,3,6,7,2,1C.4,3,6,2,1D.1,2,3,4
考题
试题基于以下描述:有一个初始为空的栈和下面的输入序列A、B、C、D、 E、F、G;现经过如下操作:push,push,pop,push,push,top,push,pop,pop。_________是从栈中删除元素的序列。A.BEDB.BDEC.BEDCD.BDEC
考题
( 15 )请将下列栈类 Stack 补充完整class Stack{private:int pList[100]; // int 数组 , 用于存放栈的元素int top; // 栈顶元素 ( 数组下标 )public:Stack():top(0){}void Push(const int item); // 新元素 item 压入栈int Pop(void); // 将栈顶元素弹出栈};void Stack::Push(const int item){if(top == 99) // 如果栈满 , 程序终止exit(1);top++; // 栈顶指针增 1___________;}int Stack::Pop(){if(top0) // 如果栈空 , 程序终止exit(1);return pList[top--];}
考题
( 3 )有一个初始为空的栈和下面的输入序列 A,B,C,D,E,F , 现经过如下操作: push, push,top,pop, top, push, push, push, top, pop, pop, pop, push 。 上述操作序列完成后栈中的元素列表(从底到顶)为【 3 】 。
考题
He ________ a top London clinic yesterday for an operation on his knee.A、checked withB、checked outC、checked forD、checked into
考题
以下程序实现栈的入栈和出栈的操作。其中有两个类:一个是节点类node,它包含点值和指向上一个节点的指针 prev;另一个类是栈类 stack, 它包含栈的头指针 top。生成的链式栈如下图所示。〈IMG nClick=over(this) title=放大 src="tp/jsj/2jc++j28.1.gif"〉下面是实现程序,请填空完成此程序。include 〈iostream〉using namespace std;class stack;class node{int data;node *prev;public:node(int d, node *n){data=d;prev=n;}friend class stack;};class stack{node *top; //栈头public:stack(){top=0;}void push(int i){node *n=【 】;top=n;}int pop(){node *t=top;if (top){top=top-〉prev;int c= t-〉data;delete t;return c;}return 0;}int main (){stack s;s.push(6);s.push(3);s.push (1);return 0;}
考题
下面程序是一个堆栈的类模板,在横线处填上适当语句,完成类模板的定义。define MAXSIZE 100template <class T>class Stack{T s[MAXSIZE];int top;public:stack(){top=1;}void push(T newValue){if(top<MAXSIZE){top=top+1;s[top]=newValue;}elsecout<<"堆栈满,无法进栈"<<end1;}void pop();};【 】{if(top>1){cout<<s[top]<<end1;top=top-1;}elsecout<<"堆栈空! "<<end1;}
考题
阅读以下说明和C++程序,将应填入(n)处的字句写在对应栏内。【说明】以下程序的功能是设计一个栈类stack<T>,并建立一个整数栈。【程序】include < iostream. h >include < stdlib. h >const int Max =20; //栈大小template < class T >class stack{ //栈元素数组T s[Max]; //栈顶下标int top;public:stack( ){top =-1; //栈顶初始化为-1}void push( const T item); //item入栈T pop( ); //出栈int stackempty( ) const; //判断栈是否为};template < class T >void stack <T >::push(const T item){if(top==(1)){cout <<"栈满溢出" <<endl;exit(1);}top ++s[top] = item;}template < class T >T stack<T> ::pop(){T temp;if(top==(2)){cout <<"栈为空,不能出栈操作" < < endl;exit(1);}temp =s[top];top --;return temp;}template < class T >int stack < T >:: stackempty( ) const{ return top == -1;{void main( ){stack <int> st;int a[] ={1,2,3,4,5};cout <<"整数栈" <<endl;cout <<"入栈序列:" <<endl;for(int i=0;i<4;i ++){cout <<a[i] <<" ";(3);}cout << endl <<"出栈序列";while((4))tout<<(5)<<" ";cout< < endl;}
考题
下面是一个栈类的模板,其中push函数将元素i压入栈顶,pop函数弹出栈顶元素。栈初始为空,top值为0,栈顶元素在stack[top-1]中,在下面横线处填上适当的语句,完成栈类模板的定义。template<class t>class Tstack{enum{size=1000};T stack[size]int top;public:Tsack():top(0){}void push(const Ti){if(top<size)stack[top++]=i;}T pop(){if(top==O)exit(1);//栈空时终止运行retum【 】;}};
考题
请将下列栈类Stack的横线处补充完整。class Stack{private:int pList[100]; ∥int数组,用于存放栈的元素int top; ∥栈顶元素(数组下标)public:Stack():top(0){}void Push(const int item); ∥新元素item
考题
基于以下描述:有一个初始为空的栈和下面的输入序列A,B,c,D,E,F;现经过如下操作:push,push,push,top,pop,top,pop,push,pus,top,pop,pop,pop,push。下列哪一个是正确的从栈中删除元素的序列?A.CBEB.EBDC.BEDCAD.CBEDA
考题
下列问题是基于以下描述:有一个初始为空的栈和下面的输入序列A、B、C、D、E、F、C;现经过如下操作: push,push,pop,push,push,top,push,pop,pop。下列哪一个是从栈中删除元素的序列?A.BEDB.BDEC.BEDCD.BDEC
考题
基于以下描述:有一个初始为空的栈和输入序列A,B,C,D,E,F,G,现经过如下操作:push,push,top,pop,push,push,top,push,pop,pop,pop。下列哪一个是正确的从栈中删除元素的序列?A.BEB.BDC.BEDCD.BDEC
考题
有如下程序:include using namespace std;class Stack {public: Stack(unsigned n= 1
有如下程序: #include <iostream> using namespace std; class Stack { public: Stack(unsigned n= 10):size(n) {rep_=ew int[size]; top=0;} Stack(Stack s):size(s.size) { rep_=new int[size]; for(int i=0;i<size;i++) rep_[i]=s.rep_[i]; top=s.top; } ~Stack() {delete[]rep_;} void push(int a) {rep_[top]=a; top++;} int pop() {--top;return rep_[top];} bool isEmpty() const {return top==0;} private: int *rep_; unsigned size,top; }; int main() { Stack s1; for(int i= 1;i<5 ;i++) s1. push(i); Stack s2(s1); for(i= 1 ;i3;i++) cout<<s2.pop()<<','; s2.push(6); si.push(7); while(!s2.isEmpty()) cout<<s2.pop()<<','; return 0; }执行上面程序的输出是______ 。A.4,3,2,1,B.4,3,6,7,2,1,C.4,3,6,2,1,D.1,2,3,4,
考题
The operation of removing an element from the stack is said to( )the stack.A. pop B. push C. store D. fetch
考题
有一个初始为空的栈和输入序列A,B,C,D,E,F,G,现经过如下操作:push,push,top,pop,push,push,top,push,pop,pop,pop。 下列哪一个是正确的从栈中删除元素的序列?()A、BEB、BDC、BEDCD、BDEC
考题
In the context of MPLS,what is the correct action to be performed when an aggregate label is received ?()A、It adds the VPN label into the top label in the MPLS label stackB、It replaces the top label in the MPLS label stack with a VPN label and propagatesC、It replaces the bottom label in the MPLS label stack with a VPN label and propagatesD、It removes the top label in the MPLS label stack and does a Layer 3 lookup on underlying IP packetsE、None of above
考题
What is the action of "pop" in the context of MPLS switching?()A、It removes the top label in the MPLS label stack.B、It adds a top label in MPLS label stack.C、It replaces the top label in the MPLS label stack with another value.D、It replaces the top label in the MPLS label stack with a set of labels.E、None of above.
考题
()is the most frequent activities in the logistics, but generally adds no value to a product, those operation should be kept to a minimum.A、TransportationB、Handling and carryingC、Marketing forecasts
考题
单选题()is the most frequent activities in the logistics, but generally adds no value to a product, those operation should be kept to a minimum.A
TransportationB
Handling and carryingC
Marketing forecasts
考题
单选题有一个初始为空的栈和下面的输入序列A,B,C,D,E,F;现经过如下操作:push,push,push,top,pop,top,pop,push,push,top,pop,pop,pop,push。下列哪一个是正确的从栈中删除元素的序列?()A
CBEB
EBDC
BEDCAD
CBEDA
考题
单选题What is the action of "pop" in the context of MPLS switching?()A
It removes the top label in the MPLS label stack.B
It adds a top label in MPLS label stack.C
It replaces the top label in the MPLS label stack with another value.D
It replaces the top label in the MPLS label stack with a set of labels.E
None of above.
热门标签
最新试卷