python - 在 Python 中使用 sortedcontainers 来模拟 BST
问题描述
我看到有些人推荐使用SortedContainers
一些树结构,比如二叉树,就像这个reddit线程。SortedContainers的文档提到它比二叉树的典型实现更节省空间
话虽如此,我实际上并没有看到有人谈论如何使用它,如果有人对如何使用 Sortedcontainers 或 SortedCollection 模拟 BST 或类似的东西有参考,我将不胜感激
解决方案
更新:在我的用例中,我不需要“使用 sortedcontainers 来模拟树结构 X”,因为它实际上是树结构 X
推荐阅读
- node.js - 套接字 IO 允许来自 curl 的 CORS 请求,但不允许来自客户端应用程序
- google-apps-script - How to print the result of a script on the current sheet
- javascript - 如何在本地保存使用带节点的 html2pdf 生成的 pdf?
- vba - 打开表单以查找 VBA 访问中的特定记录
- math - 3D点云配准中的信息矩阵?
- rust - 为 dyn Fns 实现特征
- python - 关于使用字典而不是使用 Counter(email_lst).most_common() 的问题
- google-cloud-platform - 公开分享自定义图片 FAMILY
- spring-boot - 使用 Spring 的第一步
- java - 使用 tJavaFlex-Kafka 流在 Talend 中处理大量数据