摘要: vertex.h 1 #ifndef _VERTEX_H_ 2 #define _VERTEX_H_ 3 #include <ostream> 4 5 enum BFS_VERTEX_COLOR { 6 WHITE, 7 GRAY, 8 BLACK, 9 }; 10 11 struct Vertex 阅读全文
posted @ 2021-02-15 16:50 Ren.Yu 阅读(92) 评论(0) 推荐(0) 编辑
摘要: https://www.cnblogs.com/slime/archive/2009/11/09/1598741.html https://blog.csdn.net/ljx0305/article/details/19156271 阅读全文
posted @ 2020-01-01 15:29 Ren.Yu 阅读(125) 评论(0) 推荐(0) 编辑
摘要: 1 std::vector<std::string> split(const std::string &input) { 2 const std::string alpha {"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"}; 3 std 阅读全文
posted @ 2019-12-12 01:01 Ren.Yu 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 1 void swap(int &i, int &j) 2 { 3 int temp = i; 4 i = j; 5 j = temp; 6 } 7 8 int partition(int a[], int p, int r) 9 { 10 int x = a[r]; 11 int i = p - 1; 12 for (int j = p; j < r; j++) { 13 if (a[j] <= 阅读全文
posted @ 2019-12-01 15:56 Ren.Yu 阅读(157) 评论(0) 推荐(0) 编辑
摘要: 1 void swap(int &i, int &j) 2 { 3 int temp = i; 4 i = j; 5 j = temp; 6 } 7 8 int partition(int a[], int p, int r) 9 { 10 int x = a[r]; 11 int i = p - 1; 12 for (int ... 阅读全文
posted @ 2019-11-15 21:19 Ren.Yu 阅读(105) 评论(0) 推荐(0) 编辑
摘要: 1 inline int LEFT(int i) 2 { 3 return (i * 2 + 1); 4 } 5 6 inline int RIGHT(int i) 7 { 8 return (i * 2 + 2); 9 } 10 11 void swap(int &i, int &j) 12 { 13 int temp = i; 14 i = j; 15 j = temp; 16 } 17 18 阅读全文
posted @ 2019-11-10 23:42 Ren.Yu 阅读(111) 评论(0) 推荐(0) 编辑
摘要: 1 #include <string> 2 #include <stack> 3 #include <vector> 4 5 using std::string; 6 using std::vector; 7 using std::stack; 8 9 class Element { 10 publ 阅读全文
posted @ 2019-07-21 21:12 Ren.Yu 阅读(696) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 typedef unsigned long long ullong; 4 using std::string; 5 6 ullong factorial(ullong i) { 7 if (i > 1) { 8 return i * factorial(i - 1); 9 } 10 i... 阅读全文
posted @ 2019-07-07 18:33 Ren.Yu 阅读(439) 评论(0) 推荐(0) 编辑
摘要: 1 void merge(int v[], int b, int n) { 2 int i = 0; 3 int j = b; 4 int *temp = new int[n]; 5 for (int k = 0; k = b) { 7 temp[k] = v[j++]; 8 continue; 9 ... 阅读全文
posted @ 2019-05-26 22:30 Ren.Yu 阅读(123) 评论(0) 推荐(0) 编辑
摘要: 1 void selection_sort(int v[], int n) { 2 for (int i = 0; i < n - 1; i++) { 3 int k = i; 4 for (int j = i; j < n; j++) { 5 if (v[j] < v[k]) { 6 k... 阅读全文
posted @ 2019-05-26 17:50 Ren.Yu 阅读(130) 评论(0) 推荐(0) 编辑