我如何过滤avl树的数据

问题描述 投票:0回答:1

我为班级准备了最后的作业。关键是我们需要像文件浏览器一样使用树。我试图这样做,但我陷入了排序的困境(因为我们需要按大小,名称,日期等进行排序)。

我创建了一个名为File的类,并为该对象建立了索引。但是我意识到我无法按照我想要的标准对那棵树进行排序。如何仅使用该树(或可能不使用树)按特定过滤器排序并打印所有数据(名称,大小,日期)。

void BuscarArchivos() {
    string path;
    cout << "Ingrese la ruta: "; //type the path
    cin >> path;

    Archivo * arc2;
    string test;
    for (const auto & entry : fs::directory_iterator(path)) {
        test = entry.path().string();
        arc2 = new Archivo(test);
        tree->Insert(arc2); //indexing the file class 
    }
}
void ImprimirArchivo()...

我想按标准对文件树进行排序。

c++ avl-tree
1个回答
0
投票

对于每个标准,建立一个AVL树作为索引。索引仅用于引用存储在其他存储位置中的文件对象。

© www.soinside.com 2019 - 2024. All rights reserved.