a question about running time:
登录 | 论坛导航 -> 华新鲜事 -> 求学狮城 | 本帖共有 6 楼,当前显示第 3 楼 : 从楼主开始阅读 : 本帖树形列表 : 返回上一页
作者:cigar (等级:2 - 初出茅庐,发帖:296) 发表:2003-11-11 21:04:56  3楼 
My thoughts-->If it's a min heap: then we can find minimum in O(1) and delete minimum in O(logN); if it's a max heap: then we can find minimum in O(N)(check all leaves) and delete minimum in O(N) ( taking search minimum first into account) or O(1) if we don't care the searching time Pls correct me if i am wrong
Correction: for max heap, delete mim should be
O(logN) if we don't care the search time instead of O(1)
Put your OWN COOL signature here!
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!原文 / 传统版 / WAP版只看此人从这里展开收起列表

本帖共有 6 楼,当前显示第 3 楼,本文还有 N-1 层楼,要不你试试看:点击此处阅读更多 >>



请登录后回复:帐号   密码