freqpair.h

来自「数据结构与算法分析」· C头文件 代码 · 共 13 行

H
13
字号
template <class Elem>
class FreqPair { // An element/frequency pair
private:
  Elem it;       // An element of some sort
  int freq;      // Frequency for the element
public:
  FreqPair(const Elem& e, int f) // Constructor
    { it = e; freq = f; }
  ~FreqPair() { }                // Destructor
  int weight() { return freq; }  // Return the weight
  Elem& val() { return it; }     // Return the element
};

⌨️ 快捷键说明

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