order_list.cpp
来自「这是顺序表的实现代码,适合数据结构初学者参考.」· C++ 代码 · 共 22 行
CPP
22 行
#include "list.h"
//define
order_list::order_list(int max)
{
length = 0;
max_length = max;
items = new key[max];
}
//end
error_code order_list::insert(key record)
{
if (length >= max_length) return overflow;
int position = size();
while (items[position-1] >= record && position != 0) position--;
list<key>::insert(position, record);
return success;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?