1.用list实现stack。
template class Stack{
public:
intsize() const {___________}
voidpush(const T & x) {_________}
constT & pop() {__________}
private:
vectorvt_list;
}
麻烦解释一下这个代码,以及空白处应该填什么,谢谢。
2.递归变非递归。
#include
structNode{
double data;
Node *next;
}
void ShowList(Node* list){
cout<data< If (list->next)
ShowList(list->next);
}
麻烦解释一下这个代码,以及如何把它变成非递归的(具体的代码),谢谢。