#include<bits/stdc++.h>
using namespace std;
class LinkStack{
private:
struct Node{
int elem;
struct Node* next;
struct Node* prev;
};
struct Node* head;
struct Node* tail;
public:
LinkStack(){
head=new struct Node;
tail=new struct Node;
head->next=NULL;
head->prev=NULL;
tail=head;
}
~LinkStack(){
}
void push(int k){
struct Node* middle = new struct Node;
middle->elem=k;
tail->next=middle;
middle->prev=tail;
middle->next=NULL;
tail=middle;
}
void pop(){
if(tail==head){
cout<<"the stack is empty";
}
else{
struct Node* middle=new struct Node;
middle=tail;
LRU页面置换算法的实现(c++版)
最新推荐文章于 2022-04-06 10:59:35 发布
本文介绍了一个使用链栈实现的数据结构,并结合页面置换算法应用于内存管理。链栈包括push、pop、del、findlink和print_structure等操作。文章通过实例展示了如何处理空闲帧的引用串输入,进行页面置换决策,并输出相关信息。

最低0.47元/天 解锁文章
1806

被折叠的 条评论
为什么被折叠?



