随笔分类 -  数据结构

摘要:好久没复习以前写的数据结构了,今天看了一段以前写的插入排序。 插入排序原理:通俗讲,和打扑克牌整理牌是一个道理,从一堆混乱牌中,一张一张拿,拿一张后与前面排好的牌一个个比较,插入合适的位置。 时间复杂度:O(n^2) 阅读全文
posted @ 2017-01-12 23:18 Amoshen 阅读(200) 评论(0) 推荐(0)
摘要:1 /*程序的版权和版本声明部分: 2 **Copyright(c) 2016,电子科技大学本科生 3 **All rights reserved. 4 **文件名:二分查找 5 **程序作用:二分查找 6 **作者:Amoshen 7 **完成日期:2016.10.12 8 **版本号:V1.0 9 */ 10 #include 11 12 using namespace... 阅读全文
posted @ 2016-10-12 23:04 Amoshen 阅读(246) 评论(0) 推荐(0)
摘要:1 // 循环顺序队列.cpp : 定义控制台应用程序的入口点。 2 //适合整数 3 4 #include "stdafx.h" 5 #include 6 7 #define MAXNUM 100 8 #define true 1 9 #define false 0 10 11 typedef struct queue_type 12 { 13 int queu... 阅读全文
posted @ 2016-09-08 22:48 Amoshen 阅读(226) 评论(0) 推荐(0)
摘要:1 // 链栈.cpp : 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include 6 #include //malloc的头文件 7 8 typedef struct line_stack//栈包装 9 { 10 int x; 11 struct line_stack *next; 12 }link;... 阅读全文
posted @ 2016-08-29 23:16 Amoshen 阅读(269) 评论(0) 推荐(0)
摘要:1 // 顺序栈.cpp : 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h"//test1.0--栈表仅限Int类型 5 #include 6 7 #define true 1 8 #define false 0 9 10 typedef struct stack_type 11 { 12 int stack[100];... 阅读全文
posted @ 2016-08-28 17:26 Amoshen 阅读(399) 评论(1) 推荐(0)
摘要:void Reserve(point **head)//链表反向链接--招式one { point *p, *q, *r;//定义3个指针变量 p = (point *)malloc(sizeof(point)); q = (point *)malloc(sizeof(point)); r = (point *)malloc(sizeof(point)); ... 阅读全文
posted @ 2016-07-26 19:09 Amoshen 阅读(218) 评论(0) 推荐(0)
摘要://创建链表 void Creat_Link_List(point **head, int l) { point *p, *q;//p为指向最末端的指针(最末端指next = NULL),q为构建链表的新变量,看下面就知道 int i;//i为循环变量 p = (point *)malloc(sizeof(point)); p->next = NULL; ... 阅读全文
posted @ 2016-07-26 18:44 Amoshen 阅读(189) 评论(0) 推荐(0)