该文被密码保护。 阅读全文
posted @ 2017-11-07 19:56 白丁一枚 阅读(4) 评论(0) 推荐(0)
摘要: n^n 的位数 k = [lg(n^n)]+1=[n*lg(n)]+1; 最左边的数 x = n^n/10^(k-1); 取对数:lg(x) = n * lg(n) - (k-1) = (n*lg(n) - [n*lg(n)]); 最左边的数:[x] = [10^lg(x)] = [10^(n*lg 阅读全文
posted @ 2017-11-07 11:45 白丁一枚 阅读(491) 评论(0) 推荐(0)
摘要: #include using namespace std; void insertion_sort(int arr[], int n) { for (int i = 1; i arr[i]) { int temp = arr[i]; int j = i; while (j > 0 && arr[j-1] > tem... 阅读全文
posted @ 2017-11-07 10:10 白丁一枚 阅读(94) 评论(0) 推荐(0)
摘要: 一、基本概念 1.线段树是一颗二叉搜索树, 它储存的是区间的信息。 2 每个节点以结构体存储, 结构体包含以下几个信息: 区间左端点, 右端点; 3.线段树的基本思想:二分法 4:1、每个节点的左孩子区间范围为[l,mid],右孩子为[mid+1,r] 2、对于结点k,左孩子结点为2*k,右孩子为2 阅读全文
posted @ 2017-11-05 10:57 白丁一枚 阅读(133) 评论(0) 推荐(0)
该文被密码保护。 阅读全文
posted @ 2017-09-28 20:07 白丁一枚 阅读(2) 评论(0) 推荐(0)
摘要: #include using namespace std; struct Node{ int data; Node *next; Node(const int& Newdata, Node* nextnode=NULL):data(Newdata), next(nextnode){ } }; class Queue{ private: No... 阅读全文
posted @ 2017-09-26 11:21 白丁一枚 阅读(128) 评论(0) 推荐(0)
摘要: #include using namespace std; struct Node{ int data; Node* prev; Node* next; }; class List{ private: Node* head; public: List(); ~List(); int Length(); bool Empty(); ... 阅读全文
posted @ 2017-09-19 21:05 白丁一枚 阅读(109) 评论(0) 推荐(0)
摘要: #include #include #include using namespace std; struct Node{ int date; Node* next; }; class List{ private: Node *head; public: List() { head = new Node; head->date = 0; ... 阅读全文
posted @ 2017-09-19 19:54 白丁一枚 阅读(128) 评论(0) 推荐(0)
该文被密码保护。 阅读全文
posted @ 2017-09-12 19:40 白丁一枚 阅读(2) 评论(0) 推荐(0)
摘要: 扩展欧几里德算法 扩展欧几里德算法是用来在已知a, b求解一组x,y [x,y都是整数],使它们满足贝祖等式: ax+by = gcd(a, b) =d(解一定存在,根据数论中的相关定理)。扩展欧几里德常用在求解模线性方程及方程组中。 证明 当 b=0 gcd(a,b)=a。此时 x=1,y=0; 阅读全文
posted @ 2017-06-17 23:44 白丁一枚 阅读(183) 评论(0) 推荐(0)