/*******************************************************************************
* 数据结构教学程序:线性容器及算法测试程序
* 用于测试线性容器(动态数组、链表)及静态查找和排序算法
* 版权声明:您可以随意使用、复制或传播本代码,但请保留原作者姓名
* 作者:成都理工大学信息科学与技术学院-软件工程系-邓飞 2015.09
*******************************************************************************/
#include <stdio.h>
#include "gvector.h"
#include "glist.h"
#include "galgo.h"
#include "gqueue.h"
#include "gstack.h"
bool greaterThan(const float &d1, const float &d2)
{
return d1 > d2;
}
int main()
{
int i;
GList<float> list;
for(i=0; i<5; i++)
{
list.pushBack(float(i));
}
list.insert(3, 9);
list.pushFront(-1);
list.popFront();
list.remove(3);
GList<float>::Iterator it = list.begin();
it++;
it++;
list.insert(it, 9);
sort(list.begin(), list.end());
it = list.begin();
while(it != list.end())
{
printf("%.2f ", *it);
++it;
}
GVector<int> v;
for(i=0; i<5; i++)
{
v.pushBack(5-i);
}
printf("\n");
GVector<int>::Iterator vit = v.begin();
v.remove(vit);
v.insert(vit, 9);
sort(v.begin(), v.end());
vit = v.begin();
while(vit != v.end())
{
printf("%d ", *vit);
vit++;
}
vit = search(v.begin(), v.end(), 9);
if(vit != v.end())
{
printf("\n*it=%d\n", *vit);
}
GQueue<int> queue;
queue.enqueue(1);
int j = queue.head();
queue.dequeue();
GStack<int> stack;
stack.push(10);
GStack<int> stack2(stack);
j = stack2.pop();
return 0;
}

linxdef
- 粉丝: 1
最新资源
- 技术转移机构如何借助AI+数智应用应对市场竞争加剧与服务能力不足的挑战?.docx
- 技术转移机构如何通过AI+数智应用实现业务增长与客户价值提升?.docx
- 技术转移机构在AI+数智应用转型中面临挑战,如何借助AI+数智应用方案突破瓶颈?.docx
- 科技服务合作伙伴如何借助AI+数智应用帮助提升产品差异化竞争力?.docx
- 科技服务机构如何借力AI+数智应用提升品牌价值和客户信任度?.docx
- 科技服务产品同质化严重,如何借助AI+数智应用打造差异化竞争力?.docx
- 科技服务机构如何借助AI+数智应用低成本构建智能化服务体系?.docx
- 科技服务机构如何借助AI+数智应用低成本拓展业务增量?.docx
- 科技服务机构如何借助AI+数智应用高效满足企业多元化需求?.docx
- 科技服务机构如何借助AI+数智应用工具高效支持企业技术创新?.docx
- 科技服务机构如何借助AI+数智应用结合企业共性需求,打造高附加值解决方案?.docx
- 科技服务机构如何借助AI+数智应用工具提升品牌价值并拓展客户群体?.docx
- 科技服务机构如何借助AI+数智应用快速响应企业的临时创新需求?.docx
- 科技服务机构如何借助AI+数智应用手段丰富服务内容、延伸服务链?.docx
- 科技服务机构如何借助AI+数智应用提升产品差异化竞争力?.docx
- 科技服务机构如何借助AI+数智应用提升竞争力?.docx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



评论0