02 2021 档案
摘要:1 #include <iostream> 2 3 using namespace std; 4 5 template <typename K, typename V> 6 class BST 7 { 8 private: 9 struct node // 类内定义类、结构体 10 { 11 K k
阅读全文
摘要:struct默认成员为public的,class默认成员为private的,此外并没有什么区别 所以用一个结构体给另一个结构体赋值时,一般结构体里如果没有定义赋值运算符,则会像类那样使用默认赋值运算符或默认拷贝构造函数。 1 #include <iostream> 2 3 using namespa
阅读全文
摘要:1 #include <iostream> 2 3 using namespace std; 4 5 #define ARR_SIZE 20 6 7 void CreateRandArr(int a[]); 8 9 template <typename T> 10 class MaxPQ 11 {
阅读全文
摘要:1 #include <iostream> 2 #include <cstdlib> 3 4 #define ARR_SIZE 10 5 6 using namespace std; 7 8 9 void quicksort(int a[], int lo, int hi); 10 int part
阅读全文
摘要:1 #include <iostream> 2 #include <cstdlib> 3 4 #define ARR_SIZE 10 5 6 using namespace std; 7 8 void shellshort(int a[]); 9 void CreateRandArr(int a[]
阅读全文
摘要:1 #include <iostream> 2 #include <cstdlib> 3 4 #define ARR_SIZE 20 5 #define MIN(x, y) (x)>(y)?(y):(x) 6 using namespace std; 7 8 int kk= 0; 9 10 void
阅读全文
摘要:1 #include <iostream> 2 #include <cstdlib> 3 4 #define ARR_SIZE 10 5 6 using namespace std; 7 8 /* 想象一下打牌时发完牌整理的时候,不同的是打牌我们一眼就能看出来这张牌应该插在哪个位置,而插入排序要逐一
阅读全文
摘要:1 /* 选择排序 */ 2 3 #include <iostream> 4 #include <cstdlib> 5 6 #define ARR_SIZE 10 7 8 using namespace std; 9 10 void chosesort(int a[]); 11 void Creat
阅读全文
摘要:共同方法 顺序容器 关联容器 iterator 迭代器 注意vector,array,deque的迭代器可以iter+1,关联容器和链表的不能!只能自增,即iter++ (因为除链表外的顺序容器的内存地址是连续的,而链表和关联容器存储元素的地址是分散的) const_iterator const迭代
阅读全文

浙公网安备 33010602011771号