⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 listremove.cpp

📁 C++&datastructure书籍源码,以前外教提供现在与大家共享
💻 CPP
字号:
void Remove(Node * header, const string& key)
// post: all nodes containing key removed from list/header
{
   Node * before = header;
   Node * list = header->next;  // first "real node"

   // invariant: list = before->next, key doesn't appear in header->..->before
   while (list != 0)
   {   if (list->info == key)
       {   before->next = list->next;  // link around
           delete list;
           list = before->next;        // invariant maintained
       }
       else                            // invariant maintained
       {   before = list;
           list = list->next;         
       }
   }
 }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -