上一页 1 ··· 4 5 6 7 8
摘要: 查找和排序是计算机应用中较为基础同时也很重要的两个组成成分。特别是当今网络如此盛行,Internet上充斥着各种各样的数据,图片,文本,音视频等,用户如何搜寻自己想要的数据,服务者如何及时有效的将用户的需求返回,都需要这些基础算法的帮助。在本人复习数据结构的时候,特意结合网上各位大牛的神贴,以及自己... 阅读全文
posted @ 2014-03-13 14:50 Double_win 阅读(298) 评论(0) 推荐(0) 编辑
摘要: (定义部分摘自清华大学出版社《数据结构(C语言版)》)1. 树的定义和基本术语 树(Tree)是具有n(n>=0)个节点的有限集合。在任意一颗非空树中:(1)有且仅有一个特定的节点称为“根”(root);(2) 当n>1时,其余节点又可以分为m个互不相交的有限集合T1,T2,...,Tm。这些集合,称为子树。m为与root直接相连的节点数目。 树的节点包含一个数据元素及若干指向其子树的分支。 结点拥有的子树数目称为结点的度(degree)。 出度为0的节点称为叶子(Leaf)或者终端结点。 度不为零的结点称之为分支节点。 一棵树的度是树内各结点的度的最大值。 一棵树的深度(dept 阅读全文
posted @ 2014-03-10 16:21 Double_win 阅读(440) 评论(0) 推荐(0) 编辑
摘要: 根据清华大学出版社《数据结构(C语言版)》第三章所述,栈是限定仅在表尾进行插入或删除操作的线性表(其本质还是一个线性表)。其特性是数据入口和出口都是同一个,因此遵循“先入后出”的特性。既然是一个线性表,而且入口和出口相同,那么该结构需要有以下的数据属性:1. 栈底指针(struct Stack*ba... 阅读全文
posted @ 2014-03-10 11:37 Double_win 阅读(1516) 评论(0) 推荐(0) 编辑
摘要: 题目描述(转自:http://acm.hdu.edu.cn/showproblem.php?pid=2036)这是一道典型的求一个凸多边形面积的题,对于求解凸多边形面积,通常的思路就是将该多边形分割成多个可解的简单多边形,例如三角形或者矩形。对于连续和非连续的分布,分别可以采用积分法和三角形点分割的... 阅读全文
posted @ 2013-05-03 10:24 Double_win 阅读(1131) 评论(1) 推荐(0) 编辑
摘要: B. Find Marbletime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputPetya and Vasya are playing a game... 阅读全文
posted @ 2013-03-22 14:57 Double_win 阅读(321) 评论(0) 推荐(0) 编辑
摘要: A. Slightly Decreasing Permutationstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputPermutation p is an ordered set of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. We'll denote the i- 阅读全文
posted @ 2013-03-22 14:24 Double_win 阅读(389) 评论(0) 推荐(0) 编辑
摘要: 1 #include "stdio.h" 2 #include "stdlib.h" 3 4 // using back tracking solve the problem 5 6 int N = 8; 7 8 int a[N]={0}, b[2*N-1]={0}, c[2*N-1]={0}; 9 char queen[N];10 /*11 * a[col-1] 记录第 col 列有无皇后, 1 表示有。12 * b[row+col-2] 记录从左上数第 row+col-1 条斜率为 1 的线上有无皇后。13 * c... 阅读全文
posted @ 2012-07-26 17:45 Double_win 阅读(194) 评论(0) 推荐(0) 编辑
摘要: Little Petya very much likes computers. Recently he has received a new "Ternatron IV" as a gift from his mother. Unlike other modern computers, "Terna 阅读全文
posted @ 2012-07-26 17:41 Double_win 阅读(222) 评论(0) 推荐(0) 编辑
摘要: B. Colorful FieldFox Ciel saw a large field while she was on a bus. The field was a n × m rectangle divided into 1 × 1 cells. Some cells were wasteland, and other each cell contained crop plants: either carrots or kiwis or grapes.After seeing the field carefully, Ciel found that the crop p 阅读全文
posted @ 2012-07-25 17:34 Double_win 阅读(359) 评论(0) 推荐(0) 编辑
摘要: 熟悉编程的同学都知道,当n=100时,n!已经很大且超过了long的表示范围了。此时需要改变计算结果的存储方式。我采用数组的形式存储结果。相比于传统的迭代 将 (n-1)! 的结果作被乘数, n作乘数。本文将两者的次序变换,可大大简化计算复杂度。 1 #include <iostream> 2 using namespace std; 3 int main() 4 { 5 int res[400000]={0}; 6 int n; 7 while(cin>>n) 8 { 9 res[0]=1;10 int height=1; //*... 阅读全文
posted @ 2012-07-25 17:10 Double_win 阅读(306) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8