头文件:
#pragma once
#include
using namespace std;
template
class SeqList
{
public:
SeqList(size_t sz = INIT_SIZE);
~SeqList();
public:
bool isfull()const
{
return size > capacity;
}...
分类:
编程语言 时间:
2015-05-18 23:13:33
阅读次数:
132
//顺序表的各种操作(包括头删,尾删,插入,逆序,摧毁,清空等等)
//头文件
#pragma once
#include
using namespace std;
template
class SeqList
{
public:
SeqList(size_t sz = INIT_SIZE);
~SeqList();
public:
bool isfull() const
{retur...
分类:
编程语言 时间:
2015-05-18 23:11:29
阅读次数:
332
最近在复习数据结构,顺便看看大一的时候写的代码,看完之后比当初有了更加深刻的体会。
希望这些能提供给初学者一些参考。
//1.编写算法实现线性表就地逆置的操作
void InverseList (SeqList l)
{
for (i = 0; i <= (l.length-1)/2; i++)
{
l.elem[i] l.elem[l.len...
分类:
编程语言 时间:
2015-05-13 21:58:41
阅读次数:
158
//头文件seqlist.h
#include
using namespace std;
#include
#define ElemType int
typedef struct Node
{
ElemType data;
struct Node * next;
struct Node * prio;
}Node,*PNode;
typedef struct SeqList
{
...
分类:
其他好文 时间:
2015-05-10 17:24:34
阅读次数:
118
对单链表实现如下功能:
void InitList(List *list); //初始化单链表
bool push_back(List *list,ElemType x); //尾插法
void show_seqlist(List *list); //显示链表内容
bool push_front(List *list,ElemType x);//头插法
b...
分类:
其他好文 时间:
2015-04-30 01:00:56
阅读次数:
102
首先是main.cpp让我们来看看都有什么函数
#include
#include"SeqList.h"
using namespace std;
int main()
{
SeqList mylist;
InitSeqList(&mylist);
int select = 1;
ElemType item = 0;
ElemType pos...
分类:
其他好文 时间:
2015-04-25 16:45:44
阅读次数:
139
实现线性表的各类操作:
void InitSeqList(SeqList *list); //初始化线性表
int begain(SeqList *list); //线性表的初始位置(返回第一个下标即0)
int end(SeqList *list); //末位置(返回最后一...
分类:
其他好文 时间:
2015-04-24 09:18:17
阅读次数:
137
线性表线性结构:最常用,最简单的一种数据结构,其中的数据元素是有序且是有限的...
分类:
其他好文 时间:
2015-04-23 09:39:40
阅读次数:
136
线性表的顺序存储是将线性表中的元素存放在一组连续的存储单元中。使得在线性表中逻辑上相邻的元素在物理存储单元上也是连续的。采用顺序存储的线性表叫做顺序表。
线性表的顺序存储结构如下:
模块化设计:
头文件 结构体和相应函数的定义,声明
#ifndef _SEQLIST_H
#define _SE...
分类:
编程语言 时间:
2015-04-22 18:14:09
阅读次数:
214
头文件:using ElementType = int;
#define MaxSize 100
struct SeqList{
ElementType data[MaxSize];
int length; /*the size of the seqlist */
};
using PtrList = SeqList*;
using Position = int;
using Le...
分类:
其他好文 时间:
2015-04-16 12:27:17
阅读次数:
213