算法与数据结构回顾 – 广义表

算法与数据结构回顾 – 广义表

This article is also available in the following languages: English

图源:吟游诗人-狼娘 月巴小鹅 111776313

简述

广义表是线性表的一种推广。线性表要求表中元素拥有统一的类型,而广义表无此限制。需要注意的是,广义表和线性表长度一般认为是有限的,但广义表的深度可以是无限的(即递归表)。

广义表是一种数据结构。对广义表的常见操作包括:

  • 创建
  • 从字符串形式创建
  • 销毁
  • 复制
  • 取表头
  • 取表尾
  • 判空
  • 求长度
  • 求深度
  • 从表头插入
  • 从表头删除
  • 遍历

广义表是Lisp语言的基本数据结构。后文以Common Lisp和C++给出各基本操作的示例。

阅读更多
Algorithms and Data Structures – Generalized Lists

Algorithms and Data Structures – Generalized Lists

本文同时提供以下语言的翻译:中文

Image source: 八重神子的花嫁 月巴小鹅 126756408

Brief Introduction

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:

  • Creation
  • Create from string form
  • Destroy
  • Copy
  • Get head
  • Get tail
  • Check if empty
  • Get length
  • Get depth
  • Insert at head
  • Delete from head
  • Traverse

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.

阅读更多
Your browser is out-of-date!

Update your browser to view this website correctly.&npsb;Update my browser now

×