#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
typedef int dataTyep;
typedef struct sequeList
{
int cap;
int last;
dataTyep *data;
}sequeList;
// 初始化顺序表管理结构体
sequeList *initList(int cap)
{
sequeList *head = malloc(sizeof(struct sequeList));
if(head == NULL)
return NULL;
head->cap = cap;
head->last = -1;
head->data = calloc(cap,sizeof(dataTyep));
if(head->data == NULL)
return NULL;
return head;
}
bool isFull(sequeList *head)
{
if(head->last+1 == head->cap)
return true;
return false;
}
// 找位置
int getPos(sequeList *head, dataTyep data)
{
int pos = 0;
while(pos <= head->last && data > head->data[pos])
pos++;