1. #include <stdio.h>#include <malloc.h>#include "SeqList.h"typedef unsigned int TSeqListNode;typedef struct _tag_SeqList{ int capacity; int length; T ...
分类:
其他好文 时间:
2016-12-05 22:50:15
阅读次数:
225
#include "stdafx.h"#include <iostream>using namespace std;const int MaxSize = 100; class SeqList{ //定义一个SeqList类private: int data[MaxSize]; //存放数据元素的数 ...
分类:
编程语言 时间:
2016-11-20 19:11:47
阅读次数:
217
线性表作为一种线性数据结构,常应用于信息检索,存储管理等诸多领域,因此了解线性表的基本操作与应用对于我们学习数据结构有着十分重要的意义。 一,线性表的基本操作 首先,我们定义一个线性表的基类linearlist,并以此定义了它的派生类顺序表类seqlist和链表类singlelist.在基类中,我们 ...
分类:
其他好文 时间:
2016-09-26 14:23:27
阅读次数:
139
#include<iostream>//本线性表的last为个数,例如last为5,线性表值从0-4#include<cstdlib> const int defaultsize = 100; using namespace std; template<class T>class SeqList{p ...
分类:
其他好文 时间:
2016-09-18 08:55:24
阅读次数:
187
在C++中我们可以通过typeid来获取一个类型的名称(内置类型和自定义类型都可以),但是我们不能用这种方式获取来的名称做变量的声明。那么在C++中怎样识别对象的类型呢??我们可以通过类型萃取的方式来区分内置类型和自定义类型。例如:我们在Seqlist中要用到类型萃取,因为内置..
分类:
其他好文 时间:
2016-09-06 23:32:24
阅读次数:
141
#include<iostream>using namespace std;typedef int DataType;class SeqList{public: SeqList() :_array(NULL) , _size(0) , _capacity(0) { cout << "SeqList( ...
分类:
编程语言 时间:
2016-08-21 18:25:31
阅读次数:
181
#pragmaonce
#include<assert.h>
template<classT>
classSeqList
{
public:
SeqList()
:_a(NULL)
,_size(1)
,_capacity(1)
{}
SeqList(T*a,size_tsize)
:_a(newT[size])
,_size(size)
,_capacity(size)
{
for(size_ti=0;i<_size;++i)
{
..
分类:
编程语言 时间:
2016-08-17 06:49:00
阅读次数:
211
一、线性表1、顺序存储=============类型定义:constMaxsize=100;typedefstruct{DataTypedata[Maxsize];intlength;}SeqList;SeqListL;相关操作实现1)插入//在顺序表的第i个节点前插入节点值为x新节点voidInsertSeqList(SeqListL,inti,DataTypex){if(L.length==Maxsize)exit"表..
分类:
其他好文 时间:
2016-08-10 14:33:50
阅读次数:
245
2.1 SeqList.h: 2-3 SeqListTest.c ...
分类:
其他好文 时间:
2016-07-19 09:11:51
阅读次数:
218
学习完课程后,自己用C++实现了简单的顺序表和链表,并用约瑟夫问题做了测试,不保证完全正确。
其中有一点需要注意一下:C++中类模板声明头文件和实现头文件不可以分离到.h和.cpp中,否则无法正常编译,详见:https://www.zhihu.com/question/20630104源码
1.顺序表
//seqlist.h#pragma once
#include
us...
分类:
其他好文 时间:
2016-06-29 11:29:54
阅读次数:
283