- 博客(5)
- 收藏
- 关注
原创 [算法笔记]排序
一.插入类排序: 1)直接插入排序 算法思想:每次把一个待排序的关键字插入到有序序列的适当位置上 最好情况:初始序列已经有序,O(n) 最坏情况:初始序列逆序,n(n-1)/2 O(n^2); 平均时间复杂度:O(n^2) 空间复杂度:O(1) 稳定性:稳定 void InsertSort(int R[],int n){ int i,j; int temp; for(in...
2019-06-30 20:40:21 309
原创 [PAT-A 1033]To Fill or Not to Fill
With highways available, driving a car from Hangzhou to any other city is easy. But since the tank capacity of a car is limited, we have to find gas stations on the way from time to time. Different ga...
2019-06-24 21:09:24 187
原创 ~~~
1.scanf输入带空格字符串的方法 scanf("%[^\n]", s[i]); []里是自定义输入的结束符。不这样的话读到空格就会结束。 连续读多行字符串要getchar() 2.cout 输出string 类型需要<string> iostream.h里面定义的所有类以及对象都是在全局空间里,所以可以直接用cout 但在iostream里面,它所定义的东西都在名字空间std里面...
2019-06-23 20:11:39 55
原创 [算法笔记]数据结构算法总结-线性表
一: 线性表结构定义: #define maxSize 100 1)顺序表结构体定义: typedef struct{ int data[maxSize]; int length; }Sqlist; 2)单链表节点定义 typedef struct { int data; struct LNode *next; }Lnode; 3)双链表节点定义 typedef...
2019-06-16 18:50:43 216
原创 [PAT-A 1016]Phone Bills
1016 Phone Bills (25 分) A long-distance telephone company charges its customers by the following rules: Making a long-distance call costs a certain amount per minute, depending on the time of day when...
2019-06-12 16:29:11 235
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人