算法练习(105): 动态生长(1.5.20)
2018-01-15 本文已影响138人
kyson老师
本系列博客习题来自《算法(第四版)》,算是本人的读书笔记,如果有人在读这本书的,欢迎大家多多交流。为了方便讨论,本人新建了一个微信群(算法交流),想要加入的,请添加我的微信号:zhujinhui207407 谢谢。另外,本人的个人博客 http://www.kyson.cn 也在不停的更新中,欢迎一起讨论

知识点
- 动态生长
题目
1.5.20 动态生长。使用链表或大小可变的数组实现加权 quick-union 算法,
去掉需要预先知道对象数量的限制。为 API 添加一个新方法 newSite(),它应该返回一个类型为 int 的标识符。
1.5.20 Dynamic growth. Using linked lists or a resizing array, develop a weighted quick-union implementation that removes the restriction on needing the number of objects ahead of time. Add a method newSite() to the API, which returns an int identifier.