灯下 登录
计算机科学 / SICP / 3.3.3 Representing Tables

Exercise 3.26 · 习题

Exercise 3.26: To search a table as implemented

above, one needs to scan through the list of records. This is basically the

unordered list representation of 2.3.3. For large tables, it may

be more efficient to structure the table in a different manner. Describe a

table implementation where the (key, value) records are organized using a

binary tree, assuming that keys can be ordered in some way (e.g., numerically

or alphabetically). (Compare Exercise 2.66 of Chapter 2.)

练习 3.26:要在上述实现的表中查找,需要扫描记录的表。这本质上是 2.3.3 节中的无序表表示。对于大型表,以不同方式组织表结构可能更为高效。请描述一种表的实现,其中的(键,值)记录以二叉树的形式组织,假设键可以按某种方式排序(例如,按数值或字母顺序)。(对比第 2 章的练习 2.66。)