026 · UCI ICS46 HW6 — BST 与 AVL 树
| 项目 | 内容 |
|---|---|
| 学校 | UC Irvine |
| 课程 | ICS 46 Data Structures |
| 方向 | C++ / 二叉搜索树与自平衡树 |
| 语言 | C++ |
| 难度 | 进阶 / Intermediate |
| 上游仓库 | https://github.com/klefstad-teaching/ICS-46-HW6 |
为什么收录
官方教学仓库:实现 BSTree 与 AVLTree(继承抽象基类 BST),starter 的三个 .cpp 全空、接口完整。官方本地 gtest 只有占位用例(真实评测在 Gradescope),因此本项目按 bst.h 接口语义自写测试,README 如实注明。
The official teaching repo: implement BSTree and AVLTree over an abstract BST base. The local gtest is a placeholder (real grading on Gradescope), so our tests are self-written against the bst.h interface.
实测结果
- BST 顺序插入 1024 键退化成链(高度=1024);同样数据 AVL 高度=11 —— 教科书级对比
- 官方 demo 真实输出:sorted.txt 下 BSTree 高度 26 vs AVLTree 高度 5
- 开发中修复两个真实错误:
Node是全局类型不能写成BSTree::Node;static 成员函数不能访问非静态count(计数移到公共接口维护)