//#ifndef __SEQ_H__
//#define __SEQ_H__
//
//#include<stdio.h>
//#include<assert.h>
//#include<stdlib.h>
//
//typedef int Data Type;
//typedef struct SeqList
//{
// DataType *arr;
// size_t size; //数据个数
// size_t capicity; //容量
//}SeqList;
//
//void SeqPrint(SeqList* pSeq);
//void SeqInit(SeqList* pSeq);
//void SeqDestory(SeqList* pSeq);
//
//
//void SeqPushBack(SeqList* pSeq, DataType x); //尾插
//void SeqPopBack(SeqList* pSeq); //尾删
//
//void check_capicity(SeqList* pSeq);
//
//void SeqPushFront(SeqLsit* pSeq, DataType x); //头插
//void SeqPopFront(SeqList* pSeq);
//
//void SeqInsert(SeqList* pSeq, size_t pos, DataType x);
//void SeqErase(SeqList* pSeq, size_t pos);
//
//void swap(SeqList *q, SeqList *p);
//void BubbleSort(SeqList* pSeq);
//void SelectSort(SeqList* pSeq);
//void SelectSort(SeqList* pSeq);
//
//
//#endif//__SEQ_H__
//#define _CRT_SECURE_NO_WARNINGS 1
//#include"seq.h"
////释放
//void SeqDestory(SeqList* pSeq)
//{
// assert(pSeq);
// if(pSeq->arr)
// free(pSeq->arr);
//}
//
////初始化
//void SeqInit(SeqList* pSeq)
//{
// assert(pSeq);
// pSeq->*arr =NULL;
// pSeq->size = 0;
// pSeq->capicity = 0;
//}
//
////打印
//void SeqPrint(SeqList* pSeq)
//{
// int i = 0;
// assert(pSeq);
//
// for(i=0;i<pSeq->size;i++)
// {
// printf("%d ",pSeq->arr[i]);
// }
// printf("\");
//}
//
////尾插
//void SeqPushBack(SeqList* pSeq, DataType x)
//{
// assert(pSeq);
// check_capicity(pSeq);
// pSeq->arr[size] = x;
// size++;
//}
//
////尾删
//void SeqPopBack(SeqList* pSeq)
//{
// assert(pSeq);
// if(pSeq->size == 0)
// return;
// else
// pSeq->size--;
//}
//
////头插
//void SeqPushFront(SeqLsit* pSeq, DataType x)
//{
// int end = pSeq->size;
// assert(pSeq);
// if(pSeq->size == 0)
// {
// check_capicity(pSpeq);
// pSeq->arr[size++] = x;
// }
// else
// {
// if(pSeq->size < pSeq->capicity)
// check_capicity(pSeq);
// while(end)
// {
// pSeq->arr[end] = pSeq->arr[end-1];
// end--
// }
// pSeq->arr[end] = x;
// pSeq->size++;
// }
//}
//
////头删
//void SeqPopFront(SeqList* pSeq)
//{
// int begin = 1;
// assert(pSeq);
// if(pSeq->size == 0)
// return
// else
// {
// while(begin < pSeq->size)
// {
// pSeq->arr[begin-1] = pSeq->arr[begin];
// begin++;
// }
// pSeq->size--;
// }
//}
//
////任意位置插
//void SeqInsert(SeqList* pSeq, size_t pos, DataType x)
//{
// int end = pSeq->size;
// assert(pSeq);
// if(pSeq->size == 0)
// {
// check_capicity(pSpeq);
// pSeq->arr[size++] = x;
// }
// else
// {
// if(pSeq->size == pSeq->capicity)
// check_capicity(pSeq);
// while(end >= pos)
// {
// pSeq->arr[end] = pSeq->arr[end-1];
// end--;
// }
// pSeq->arr[end-1] = x;
// }
// pSeq->size++;
//
//}
//
////任意位置删
//void SeqErase(SeqList* pSeq, size_t pos)
//{
// int begin = pos-1;
// assert(pSeq);
// assert(pos<pSeq->size);
// while(begin < pSeq->size)
// {
// pSeq->arr[begin] = pSeq->arr[begin+1];
// begin++;
// }
// pSeq->size--;
//}
//
////申请空间
//void check_capicity(SeqList* pSeq)
//{
// size_t newcapicity = 0;
// assert(pSeq);
// if(pSeq->size == pSeq->capicity)
// {
// newcapicity = (pSeq->capicity > 0 ? pSeq->capicity * 2 : 3);
// Datatype* tmp = (Datatype*)realloc(pSeq->arr,newcapicity*sizeof(DataTpye));
// if(tmp ==NULL)
// {
// asser(flase);
// printf("增容失败\n");
// }
// else
// {
// pSeq->arr = tmp;
// }
// }
//}
////冒泡排序
//void BubbleSort(SeqList* pSeq)
//{
// size_t tmp = 0
// size_t = 0;
// size_t = 0;
// int flag = 0;
// assert(pSeq);
// for(i=0;i<pSeq->size-1;i++)
// {
// flag = 0;//
// for(j=0;j<pSeq->size-i-1;j++)
// {
// if(pSeq->arr[j]>pSeq->arr[j+1])
// {
// flag = 1;
// swap(&(Seq->arr[j]),&(pSeq->arr[j+1]));
// }
// }
// if(0 == flag)
// break;
// }
//}
//
////交换
//void swap(SeqList *q, SeqList *p)
//{
//
// SeqList *tmp;
// assert(q);
// assert(p);
// tmp = q
// q = p;
// p = tmp;
//}
//
////选择排序
//void SelectSort(SeqList* pSeq)
//{
// size_t left = 0;
// size_t right = pSeq->szie-1;
// size_t min = 0;
// size_t max = 0;
// size_t i = 0;
// assert(pSeq);
// while(left < right)
// {
// min = 0;
// max = 0;
// i = 0;
// while(i<=right)
// {
// if(pSeq->arr[i] > pSeq->arr[max])
// max = i;
// if(pSeq->arr[i] < pSeq->arr[min])
// min = i;
// }
// swap(&(pSeq->arr[left]),&(pSeq->arr[min]));
//
// if(max == left) ////
// max = min; ////
//
// swar(&(pSeq->arr[right]),&(pSeq->arr[max]));
// left++;
// right--;
// }
//}
//
////二分查找
//
//int binary_search(SeqList* pSeq, DataType k)
//{
// size_t left = 0;
// size_t right = pSeq->size-1; //[]
// size_t mid = 0;
// assert(pSeq);
// while(left <= right) //
// {
// mid = (left & right) + ((left ^ right)>>1);
// if(pSeq->arr[mid] == k)
// return mid;
// else if(pSeq->arr[mid] < k)
// left = mid + 1;
// else
// right = mid -1;
//
// left++;
// right--;
// }
// return -1;
//}