Skip to content

【091-week03】学习总结 #588

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
DevinSu opened this issue May 5, 2019 · 0 comments
Open

【091-week03】学习总结 #588

DevinSu opened this issue May 5, 2019 · 0 comments

Comments

@DevinSu
Copy link
Contributor

DevinSu commented May 5, 2019

数据流中最小的k值

思路就是将数组变为最小堆,而这个最小堆只保留k个数。最小堆借用heapq工具包,加入add函数的数据进行堆排序。 #当数据不足k,加入数据。当数据等于k。比较堆顶和新进来的值,如果堆顶小于这个值,就将堆顶弹出,将值加入到堆中。 #此时这个堆中还是保留了k个值,这个堆顶还是低第k个大的值。

二叉树最大深度
递归实现 比较简单 没什么好说的 非递归实现 就像是层序遍历一样 使用队列来实现 每一次pop或者是push的时候将level+1;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant