We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
数据流中最小的k值
思路就是将数组变为最小堆,而这个最小堆只保留k个数。最小堆借用heapq工具包,加入add函数的数据进行堆排序。 #当数据不足k,加入数据。当数据等于k。比较堆顶和新进来的值,如果堆顶小于这个值,就将堆顶弹出,将值加入到堆中。 #此时这个堆中还是保留了k个值,这个堆顶还是低第k个大的值。
二叉树最大深度 递归实现 比较简单 没什么好说的 非递归实现 就像是层序遍历一样 使用队列来实现 每一次pop或者是push的时候将level+1;
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Uh oh!
There was an error while loading. Please reload this page.
数据流中最小的k值
思路就是将数组变为最小堆,而这个最小堆只保留k个数。最小堆借用heapq工具包,加入add函数的数据进行堆排序。 #当数据不足k,加入数据。当数据等于k。比较堆顶和新进来的值,如果堆顶小于这个值,就将堆顶弹出,将值加入到堆中。 #此时这个堆中还是保留了k个值,这个堆顶还是低第k个大的值。
二叉树最大深度
递归实现 比较简单 没什么好说的 非递归实现 就像是层序遍历一样 使用队列来实现 每一次pop或者是push的时候将level+1;
The text was updated successfully, but these errors were encountered: