图源:吟游诗人-狼娘 月巴小鹅 111776313
简述
广义表是线性表的一种推广。线性表要求表中元素拥有统一的类型,而广义表无此限制。需要注意的是,广义表和线性表长度一般认为是有限的,但广义表的深度可以是无限的(即递归表)。
广义表是一种数据结构。对广义表的常见操作包括:
- 创建
- 从字符串形式创建
- 销毁
- 复制
- 取表头
- 取表尾
- 判空
- 求长度
- 求深度
- 从表头插入
- 从表头删除
- 遍历
广义表是Lisp语言的基本数据结构。后文以Common Lisp和C++给出各基本操作的示例。
图源:吟游诗人-狼娘 月巴小鹅 111776313
广义表是线性表的一种推广。线性表要求表中元素拥有统一的类型,而广义表无此限制。需要注意的是,广义表和线性表长度一般认为是有限的,但广义表的深度可以是无限的(即递归表)。
广义表是一种数据结构。对广义表的常见操作包括:
广义表是Lisp语言的基本数据结构。后文以Common Lisp和C++给出各基本操作的示例。
Algorithms and Data Structures – Generalized Lists
Image source: 八重神子的花嫁 月巴小鹅 126756408
A generalized list is an extension of a linear list. While a linear list requires all elements to be of the same type, a generalized list has no such restriction. It’s important to note that both generalized lists and linear lists are generally considered to have finite lengths, but the depth of a generalized list can be infinite (i.e., a recursive list).
A generalized list is a type of data structure. Common operations on generalized lists include:
Generalized lists are the fundamental data structure in Lisp. Examples of each basic operation are provided in Common Lisp and C++ in the following sections.
Update your browser to view this website correctly.&npsb;Update my browser now