[理工] 资料结构 时间复杂度

楼主: ooxx5626 (杨霖村)   2018-01-17 17:48:11
两个问题 都是是非题
disjoint-set forest , unique element,wightrule is applied那 下面这个例子会成立吗?
1.In the worst case, find an element in a set of size n take theta(logn)
在最糟情况find 还是可以保持趋近O(1)吗?还有disjoint-set 有很多种find和union 那是要用哪一种来看还是,就用最好的find和union呢?
2.The complexity of a comparison based algorithm cannot be faster than O(nlogn)
如果非comparison based algorithm 可以突破nlogn,但是如果是Best case不可以了吗? 像这题要考虑Best case吗@@
作者: nova06091   2018-01-17 17:53:00
1 worst case不是应该用没collapse的find? 我觉得第二题题目是 BigO??
作者: q1qip123 (wtlee)   2018-01-17 18:33:00
第一题 你用最好的find也是O(lgn),可以翻一下笔记,他会是alpha(n),不会是常数
楼主: ooxx5626 (杨霖村)   2018-01-17 19:45:00
n大 那是bigO没错 手机打字直接用O了XDq大 嗯嗯应该是我错了会趋近1是在压缩过的路径的分摊成本才会这样
作者: FRAXIS (喔喔)   2018-01-17 20:45:00
第二题 只要题目没讲 都是指 worst case..
作者: q1qip123 (wtlee)   2018-01-17 22:14:00
其实是我讲错了… 不过感觉你理解的方向是对的他是考虑用weighting rule 所以union的方式有决定了 这样worst case才会是lgn
作者: tung3567752 (渡鸦已连线)   2018-01-17 23:35:00
第二题如果用comparison tree看time complexity应该是对的吧,leaf=2^height=n!

Links booklink

Contact Us: admin [ a t ] ucptt.com