难产的笔记。。。本来打算用1天 结果前前后后拖了5天§9.1 静态查找表9.1.1 顺序表的查找各种扫 自己脑补吧 复杂度O(n)9.1.2 有序表的查找若表是单调的,则可以利用二分查找。复杂度O(logn)9.1.3 静态树表的查找见
http://blog.csdn.net/area_52/article/details/437958379.1.4 索引顺序表的查找建立索引表查找§9.2...
分类:
其他好文 时间:
2015-02-15 16:35:32
阅读次数:
238
在很多地方都看到了散列表(hash表)这种数据结构。 基本原理:提供一个散列函数,把不同的关键字映射到不同的存储单元。 问题1)信息怎么来存储?是用数组还是链表?如果用数组,数组大小又如何来确定? 问题2)如果确定散列函数? 问题3)不同的关键字一定能映射到不用的存储单元么?如果不能,又如何来处理....
分类:
其他好文 时间:
2015-02-15 16:31:02
阅读次数:
121
1.Hash表的结构首先,允许我们花一点时间来简单介绍hash表。1.什么是hash表hash表是一种二维结构,管理着一对对这样的键值对,Hash表的结构如下图所示:如上图所示,左侧部分是一个一维顺序存储的数组,数组单元格里的内容是指向另一个链式数组的指针。图中绿色部分是,绿色部分右侧的白色部分是指...
分类:
编程语言 时间:
2015-02-07 10:16:10
阅读次数:
322
题目链接:Valid Sudoku
Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.
The Sudoku board could be partially filled, where empty cells are filled with the character '.'.
Note:
A...
分类:
其他好文 时间:
2015-02-06 00:50:56
阅读次数:
189
题目链接:Sudoku Solver
Write a program to solve a Sudoku puzzle by filling the empty cells.
Empty cells are indicated by the character '.'.
You may assume that there will be only one unique solution.
...
分类:
其他好文 时间:
2015-02-06 00:49:25
阅读次数:
155
题目链接:Substring with Concatenation
of All Words
You are given a string, S, and a list of words, L, that are all of the same length. Find all starting indices of substring(s) in S that is a concatena...
分类:
其他好文 时间:
2015-02-02 23:09:55
阅读次数:
253
题目链接:http://poj.org/problem?id=2153思路分析:判断Li Ming的成绩排名,需要在所有的数据章查找成绩比其高的人的数目,为查找问题。查找问题可以使用Hash表,STL中的Map,查找树,或者使用排序与二分查找即可。代码:#include #include #incl...
分类:
其他好文 时间:
2015-01-31 14:31:38
阅读次数:
171
题意:给定m,l,一个字符串str。
我们定义一个子串为"recoverable”串 当
1、长度为 M*L
2、把这个好串分成M段,每段长度为L,且每段各不相同。
求“recoverable”串的个数,串相同位置不同也算不同。
思路:预处理数组hash,hash[i]表示从i位置到尾的字符串hash值。这里数组为unsigned long long型,因为可以自动取模。然后枚举
...
分类:
其他好文 时间:
2015-01-30 22:48:49
阅读次数:
301
题目链接:4Sum
Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target.
Note:
...
分类:
其他好文 时间:
2015-01-30 22:42:54
阅读次数:
251
题目链接:[Two Sum](https://oj.leetcode.com/problems/two-sum/ )Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of th...
分类:
其他好文 时间:
2015-01-27 23:36:58
阅读次数:
356