版本比较
数据结构
正文
增加 5 行删除 5 行
37 行未改动3839404142424344454633 行未改动8081828384848586878877 行未改动166167168169170170171172173174817 行未改动全部展开9929939949959969969979989991000100110011002100310041005155 行未改动全部展开37 行未改动 } else if(op==3)cout<<top<<"\n";//栈的大小 else cout<<sta[top]<<"\n";//输出栈顶 } return 0; return 0;}```
##### STL 实现33 行未改动 } else if(op==3)cout<<sta.size()<<"\n"; else cout<<sta.top()<<"\n"; } return 0; return 0;}```
#### 例题77 行未改动 { q.push(d); } if(s[i]=='.') continue; if(s[i]=='+') if(s[i]=='+') { int a=q.top();q.pop(); int b=q.top();q.pop(); q.push(a+b);817 行未改动全部展开 cin>>x>>y; a[y]=a[x]; a[x]=y; }//将元素y插入到x后面 else if(it==2) else if(it==2) { cin>>x; cout<<a[x]<<endl; }//询问x后面的元素是什么。 else if(it==3) else if(it==3) { cin>>x; a[x]=a[a[x]]; }//从表中删除元素x后面的那个元素。155 行未改动全部展开