Objective-C 复杂度引用

标签 objective-c complexity-theory

对于 c++ STL,有一个 de-facto standard location (除了 de-jour standard 之外,我的意思是)查找有关标准容器操作的复杂性保证的信息。

Is there an analogous, web-accessible document listing complexity guarantees for NSArray, NSDictionary, etc.?

例如,我找不到为 [NSArray count] 提供复杂性的引用

最佳答案

正确。没有一个。 C++/STL(基于我有限的理解)非常注重性能。 Objective-C/Foundation 基本上不会。

NSArray, NSDictionary 和 friend 是接口(interface)。它们告诉您如何使用它们,而不是它们的行为方式。这使他们可以出于性能原因自由切换引擎盖下的实现。关键是,您不需要关心,而且 API 中不会指定这一点,因此即使您想要也做不到 ;)

要真正了解这个主题,突出实现开关,并粗略比较基础类和 STL/C 数据结构,请查看 Ridiculous Fish(由 Apple AppKit 团队的某人撰写)blog post about "Our arrays, aren't"

关于Objective-C 复杂度引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9956422/

相关文章:

iphone - 如何在初始化后定义 UITableViewCell 样式?

iphone - UITableViewCell sizeToFit 中的 UITextView 未按预期工作

algorithm - 模拟理论 - 如何排序只有 log(p)?

language-agnostic - 不同的数据结构和复杂性

iphone - 访问其他类中的变量时为空值(组合导航和选项卡 Controller )

iphone - Objective-C : How to make a subclass of UIControl react like a button

algorithm - 在 DAG 中找到断开特定部分路径的最小顶点集

在数组中查找 'maximal difference' 的 C++ 算法

objective-c - 如何使用 cocoa 将 OS X 中的视网膜切换为非视网膜

python:os.path.exists 的复杂性存在于 ext4 文件系统中?