集合数据结构及其操作的实现与分析
1. 集合数据结构的实现
集合(Set)是一种重要的数据结构。为了实现集合,我们可以将其作为链表来处理,一种简单的方式是使用 typedef
将 Set
定义为 List
,如下所示:
/*****************************************************************************
* *
* -------------------------------- set.h --------------------------------- *
* *
*****************************************************************************/
#ifndef SET_H
#define SET_H
#include <stdlib.h>
#include "list.h"
/*****************************************************************************
*