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

📄 key.h

📁 这是本人精心搜集的关于常用图论算法的一套源码
💻 H
字号:
// Definition of a Key class:
class Key
{ public:
   static int comparisons;
    Key(int x=0)
      { key = x;  }
    int the_key( ) const{ return key; } 
    Key& operator=(const int x)
     { key = x;  return *this; }
    Key& operator=(const Key& copy)
     { key = copy.key;  return *this; }       
  protected:
    int key;
};

int Key::comparisons = 0;
bool operator==(const Key &x, const Key &y)
{  Key::comparisons++;
   return x.the_key( ) == y.the_key( );
}
bool operator>(const Key &x, const Key &y)
{  Key::comparisons++;
   return x.the_key( ) > y.the_key( );
}
bool operator>=(const Key &x, const Key &y)
{  Key::comparisons++;
   return x.the_key( ) >= y.the_key( );
}
bool operator<(const Key &x, const Key &y)
{  Key::comparisons++;
   return x.the_key( ) < y.the_key( );
}
bool operator<=(const Key &x, const Key &y)
{  Key::comparisons++;
   return x.the_key( ) <= y.the_key( );
}

⌨️ 快捷键说明

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