- 博客(11)
- 资源 (1)
- 收藏
- 关注
转载 哈希表等概率情况下查找成功和查找不成功的平均查找长度的计算
最近复习了下数据结构中的哈希表,发现在计算等概率情况下查找不成功的平均查找长度时比较迷茫,不知道到底是怎么计算出来的。现在通过查阅资料终于知道如何计算了,所以记录下来以供以后查阅。 下面看下2010年2010年全国硕士研究生入学统一考试计算机科学与技术学科联考计算机学科专业基础综合试题中一个考哈希表的题。Question1:将关键字序列(7、8、30、11、18、9、14)散列存储
2016-12-13 10:42:17 4254 3
原创 中缀转后缀表达式,以及表达式的值
#include <cstdio>#include <stack>#include <cstring>#include <ctype.h>using namespace std;typedef double YP;int precede(char ch1,char ch2){ if(ch1 == '*'||ch1 == '/'){ return 0;}else i
2016-12-11 21:43:35 234
原创 srand()函数用法
#include <cstdio>#include <cstdlib>#include <algorithm>#include <ctime>using namespace std;int main(){ srand((unsigned)time(NULL)); int a[3]; for(int i = 0; i < 3 ; i++) a[i] = rand();
2016-12-11 08:48:51 754
原创 HDU2087
一块花布条,里面有些图案,另有一块直接可用的小饰条,里面也有一些图案。对于给定的花布条和小饰条,计算一下能从花布条中尽可能剪出几块小饰条来呢? Input 输入中含有一些数据,分别是成对出现的花布条和小饰条,其布条都是用可见ASCII字符表示的,可见的ASCII字符有多少个,布条的花纹也有多少种花样。花纹条和小饰条不会超过1000个字符长。如果遇见#字符,则不再进行工作。 Output ...
2016-12-10 11:26:25 291
原创 HDU1686
The French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter ‘e’. He was a member of the Oulipo group. A quote from the book: Tout avait Pair normal, mais tout s...
2016-12-10 11:23:16 212
原创 递归实现二叉树的三种遍历
#include <stdio.h>#include <stdlib.h>typedef char ElementType;typedef struct TreeNode *BinTree;struct TreeNode{ElementType Data;BinTree lchild;BinTree rchild;};//建立 void creatBinTree(BinTree
2016-12-10 10:26:09 405
原创 deque的简单用法
#include <iostream>#include <deque>using namespace std;int main(){ deque<int> q; q.push_back(1); q.push_back(2); q.push_back(3); cout<<"before inserted(1,2,3) _back:"<<endl;
2016-12-10 10:24:03 326
原创 JAVA中管道Piped输入输出流
import java.io.IOException;import java.io.PipedInputStream;import java.io.PipedOutputStream;/*管道流要用到线程的知识 * * / */class write implements Runnable{ private PipedOutputStream out = null; p
2016-12-05 16:56:44 870
原创 简单的串的匹配kmp
这博客写的很好。 http://blog.csdn.net/v_july_v/article/details/7041827//然后我根据他的解释,写的。 //首先是暴力的复杂度O(n*m);#include <bits/stdc++.h>using namespace std;int ViolentMatch(char* s, char* p) { ...
2016-12-03 01:36:03 338
原创 stl实现全排列模板
#include <bits/stdc++.h>using namespace std;int main(int argc, char const *argv[]){ string s; cin>>s; while(next_permutation(s.begin(),s.end())) cout<<s<<endl; return 0;}
2016-12-01 13:47:08 307
原创 矩阵快速幂
#include <cstdio>#include <iostream>using namespace std;const int MOD = 10000;struct matrix{ int m[2][2];}ans, base;matrix multi(matrix a, matrix b){ matrix tmp; for(int i = 0; i < 2; +
2016-12-01 13:31:00 343
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人