Cocoa Touch是否有搜索树数据结构? [英] Does Cocoa Touch have a search tree data structure?

查看:187
本文介绍了Cocoa Touch是否有搜索树数据结构?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在Google上查看这个,读取SDK文档中的Collections条目,并没有打开。是否有一个BST(任何变体)实现开箱即用的iOS SDK?

I've been looking into this on Google and read the Collections entry in the SDK documentation, and turned up nothing. Is there a BST (any of its variants) implementation available out of the box with the iOS SDK?

似乎很奇怪的东西,所以基本的,将失去一个重大的发展平台。是他们的哈希实现只是那个神奇?

It seems odd that something so basic would be missing from a major development platform. Is their hash implementation just that magical? Or do the devs assume no one is going to do inserts/deletes on things that have an order?

我可以使用 NSSet 现在,因为我知道我们中的大多数人(包括我自己)不是真的在iOS上需要一个保证访问时间吨的计算,但它仍然在我啃的计算。

I can use NSSet for now, as I know most of us (myself included) aren't really writing anything with tons of computation on iOS that need a guaranteed access time, but it's still gnawing at me.

推荐答案

CFBinaryHeap看起来很有前途和有用,但它可能不是你想要的,因为它不是一个真正的二叉搜索树,但 heap 。他们是相似的,但不一样,所以我觉得像Core Foundation的 CFTree 类可能会更好一些。下面是CFTree类引用的描述:

CFBinaryHeap looks pretty promising and useful, but it might not be exactly what you want, as it's not really a binary search tree but a heap. They are similar, but not the same, so I feel like Core Foundation's CFTree class might be a little better. Here's a description from the CFTree class reference:


您使用CFTree创建表示分层信息组织的树结构。在这种结构中,每个树节点只有一个父树(除了根树之外,没有父树),并且可以有多个子树。

You use CFTree to create tree structures that represent hierarchical organizations of information. In such structures, each tree node has exactly one parent tree (except for the root tree, which has no parent) and can have multiple children.

如果你不习惯C(核心基础是C,而不是Objective-C),你可以使用JKPTree库,它是CFTree的Objective-C包装器。您可以下载此处

If you're not comfortable with C (Core Foundation is C, not Objective-C), you can use the JKPTree library which is an Objective-C wrapper of CFTree. You can download it here.

我刚刚找到一个名为 CHDataStructures 的库,它简化了各种各样的数据结构。它支持以下数据结构(以及许多其他未列出的数据结构):

I just found another library called CHDataStructures that simplifies the creation of a wide variety of data structures. It supports the following data structures (and many other unlisted ones):


  • AVL树

  • 二元搜索树

  • 安德森树

  • 链接列表

  • 搜索树


  • 不平衡树

  • 排队

  • AVL Tree
  • Abstract Binary Search Tree
  • Andersson Tree
  • Linked List
  • Search Tree
  • Red Black Tree
  • Unbalanced Tree
  • Queue
  • Heap

您可以下载CHDataStructures 这里

You can download CHDataStructures here.

这篇关于Cocoa Touch是否有搜索树数据结构?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆