顺序表,其实很多地方同数组很有相似,可以说数组也是一种顺序表。对顺序表的基本操作有,初始化,插入元素,删除元素,访问表,元素定位,制空表,删除顺序表。发一段功能集成代码。-------------------------------- end ---------------------------....
分类:
其他好文 时间:
2015-03-17 19:46:26
阅读次数:
135
//使用结构体构造线性表typedef struct SeqList{ ElemType *elem; size_t capacity; size_t size;}SeqList;//使用模板类来构造线性表const int DefaultSize = 100;templa...
分类:
编程语言 时间:
2015-03-10 17:10:30
阅读次数:
303
??
//seqlist.h
#ifndef _SEQLIST_H_
#define _SEQLIST_H_
#define MAXSIZE 100
typedef struct
{
int listLen; //节点数量
DATA_T dataList[MAXSIZE+1];
}seqListType;
/* 初始化顺序表 */
void seqli...
分类:
编程语言 时间:
2015-01-23 13:32:07
阅读次数:
155
#include
#include
#include
typedef struct seqlistNode
{
int date;
}seqlistNode;
typedef struct SEQLIST
{
unsigned int lengh; //长度
unsigned int count; //已存元素长度
seqlistNode * date; //数据...
分类:
其他好文 时间:
2015-01-18 14:24:40
阅读次数:
201
SeqList.h 1 #define ListSize 100 2 3 typedef int DataType; 4 typedef struct { 5 DataType list[ListSize]; 6 int length; 7 }SeqList; 8 9 void ...
分类:
其他好文 时间:
2015-01-04 14:55:28
阅读次数:
269
从结构性上考虑,通常将data 和last 封装成一个结构作为顺序表的类型:typedef struct{ datatype data[MAXSIZE];int last;} SeqList;1.顺序表的初始化顺序表的初始化即构造一个空表,这对表是一个加工型的运算,因此,将L设为指针参数,首先动态分...
分类:
其他好文 时间:
2014-12-19 18:57:55
阅读次数:
180
#ifndef _SEQLIST_H_#define _SEQLIST_H_typedef void SeqList;typedef void SeqListNode;SeqList* SeqList_Create(int capacity);void SeqList_Destroy(SeqList...
分类:
其他好文 时间:
2014-11-27 12:01:15
阅读次数:
112
??
#ifndef SEQLIST_H
#define SEQLIST_H
#include
using namespace std;
const int Maxsize = 100;
template
class SeqList
{
public:
SeqList();//构造空链表
SeqList(T a[], int n); //构造长度为n的链表
~SeqL...
分类:
其他好文 时间:
2014-10-23 19:23:21
阅读次数:
155
#include using namespace std;#define MaxSize 25typedef int DataType;class SeqList{ DataType list[MaxSize]; int length; public: SeqList(){length ...
分类:
其他好文 时间:
2014-10-09 22:18:17
阅读次数:
202
线性表之顺序表奇偶调整,就是指将顺序表的奇数与偶数位置互换,以最优方法解决,因为方法很多,比如,开辟一个新的顺序表分别存放奇偶数,也可以从头向后寻找奇偶数放置到尾部或头部,但这些都会增大时间与空间的消耗。最优法则是前后分别寻找奇偶不同类型数,满足前奇后偶(或前偶后期),交换两数位置,实现时间复杂度O(n),空间O(1)的方案。
void AdjustSqlist(SeqList *L)
{
...
分类:
其他好文 时间:
2014-09-21 22:34:33
阅读次数:
510