Tag: 前缀树

前缀树实现

我正在处理存储城市列表(从文件中读取)及其相应的纬度和经度值。 在每个城市的尽头,我试图追加经度和纬度值。 因此,例如,特里的弗里蒙特看起来像 F-> R-> E-> M-> O-> N-> T – >(纬度和经度) 我能够成功地将值插入到trie中,但是当我尝试搜索特定城市时,经度和纬度值将返回为(null) 这是我的实施 void readFile(){ //the functions that deal with the trie struct trieNode *node = initializeTrie(); trieInsert(node, place, longitude, latitude); getTrie(node, place); trieFree(node); } struct trieNode{ char *longi; char *lat; struct trieNode *children[27]; char value; }; struct trieNode *initializeTrie(){ struct trieNode *pNode = […]