📄 readme
字号:
Hash TreeThere are 3 classes: HashTree, HashNode & IntList. And The users onlyrequired to handleHashTree & IntList. HashNode is not need to be handle by users.The index used in HashTree is in the form of IntList. The details ofHashTree and IntListare describe in the following.FileThere are 4 files:HashTree.hHashTree.CIntList.hIntList.CBefore you useYou must include HashTree.h & IntList.h in your program. AndYou have to modify some parts in HashTree.h & HashTree.C for yourrequirement.HashTree.hAt the beginning, you should input the data you want to store in each nodeof Hash Treein the structure "Content".HashTree.C1. in line 31input how do you initialize of the data you want to store. (Struct Contentcon[i])2. in line 218input how can you print your data out. (Struct Content con[i])3. in line 369input how do you set the return data if no node found in searching.How to Use?IntList: IntList();Construct a new blank integer list. ~IntList();Destructor void prepend(int n);Prepend an item to the list void append(int n);append an item to the list void insertSorted(int n);Insert an item into a SORTED listRemark: the original list must be sorted void remove(int n);remoce n+1 th element in the list listnode* locate(int n);try to locate an item and return the node void copy(const IntList& il);copy the list void clear();delete all node and released memony bool isEmpty()check if the list is empty bool compare_k_1(const IntList& il);compare the first k-1 item of 2 list to see if they are the same bool exist(int n);Check if a value exist in the list listnode* get_head();return the head of the list int get_len();return the length of the list void show() const;show the list int operator[] (int i) const;Retrieve the (i+1)-th element of the linked-list bool operator== (const IntList& il) const;compare 2 listsHashTree: HashTree(int n, int d);Construct a new HashTree, n is the branching factor, d is the depth of theindex(The length of all index used in the hash tree must equal to this depth, eg.if you set d=3, the the index "12" or "1234" is invalid when "123" is valid) ~HashTree();destructor void insert(const IntList& ss);insert a new node. Only index is required. You should use setCon to setcontents. void remove(const IntList& ss);remove a node. void show() const { root->show(); }display all nodes in hash tree. bool exist(const IntList& il) const;to check if one node is exist in the hash tree. void convert2array(IntList*& ia, int& idx_ss) const;convert the data in hash tree into array void setCon(const IntList& ss, const Content& es);set the content of the nodes Content findStat(const IntList& ss) const;get the content of the nodes.Problem or suggestionPls feel free to contact wtchan@cse.cuhk.edu.hk
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -