Skip to content

手撕代码双向链表实现LRU里的show函数 #15

@jackson-119

Description

@jackson-119

void LRUCache::show(){
//链表中没有节点,退出
if(head_node->next = head_node){
return;
}
Node* tmp = head_node->next;
while(tmp->next != head_node){
std::cout<<"key:"<key<<",vlaue:"<value<<std::endl;
}
}

这里的while循环是不是有点问题啊,条件应该是tmp!=head_node,里面应该加一句tmp=tmp->next?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions