码迷,mamicode.com
首页 >  
搜索关键字:剑指offer c++    ( 3728个结果
剑指 Offer 题目索引
剑指 Offer 题目索引
分类:其他好文   时间:2014-05-05 23:39:02    阅读次数:348
经典白话算法之归并排序
void Merge(int A[],int p,int q,int r){ int i,j,k; //计算子数组A[p..q]的元素个数 int n1 = q - p + 1; //计算子数组A[q+1..r]元素个数 int n2 = r - q; //创建子数组L,R int* L = (int*)malloc(sizeof(int)*...
分类:其他好文   时间:2014-05-04 12:44:38    阅读次数:384
经典白话算法之优先级队列
概念 优先级队列,顾名思义,就是一种根据一定优先级存储和取出数据的队列。它可以说是队列和排序的完美结合体,不仅可以存储数据,还可以将这些数据按照我们设定的规则进行排序。优先级队列是堆的一种常见应用。有最大优先级队列(最大堆)和最小优先级队列(最小堆)。优先级队列是一种维护有一组元素构成的集合S的数据结构。 优先队列支持的基本运算 [cpp] view plai...
分类:其他好文   时间:2014-05-03 17:00:11    阅读次数:341
经典白话算法之中缀表达式和后缀表达式
一、后缀表达式求值 后缀表达式也叫逆波兰表达式,其求值过程可以用到栈来辅助存储。 假定待求值的后缀表达式为:6  5  2  3  + 8 * + 3  +  *,则其求值过程如下: (1)遍历表达式,遇到的数字首先放入栈中,依次读入6 5 2 3 此时栈如下所示: (2)接着读到“+”,则从栈中弹出3和2,执行3+2,计算结果等于5,并将5压入到栈中。...
分类:其他好文   时间:2014-05-03 16:59:21    阅读次数:309
经典白话算法之二叉树中序前序序列(或后序)求解树
这种题一般有二种形式,共同点是都已知中序序列。如果没有中序序列,是无法唯一确定一棵树的。 已知二叉树的前序序列和中序序列,求解树。 1、确定树的根节点。树根是当前树中所有元素在前序遍历中最先出现的元素。 2、求解树的子树。找出根节点在中序遍历中的位置,根左边的所有元素就是左子树,根右边的所有元素就是右子树。若根节点左边或右边为空,则该方向子树为空;若根节点 边和右边都为空,...
分类:其他好文   时间:2014-05-03 16:58:36    阅读次数:325
UVA 之10010 - Where's Waldorf?
Where's Waldorf?  Given a m by n grid of letters, ( ), and a list of words, find the location in the grid at which the word can be found. A word matches a straight, uninterrupted line o...
分类:其他好文   时间:2014-05-02 10:59:15    阅读次数:514
UVA 之401 - Palindromes
A regular palindrome is a string of numbers or letters that is the same forward as backward. For example, the string "ABCDEDCBA" is a palindrome because it is the same when the string is read from lef...
分类:其他好文   时间:2014-05-02 10:33:09    阅读次数:332
UVA 之11300 - Spreading the Wealth
Problem A Communist regime is trying to redistribute wealth in a village. They have have decided to sit everyone around a circular table. First, everyone has converted all of their properties to co...
分类:其他好文   时间:2014-05-02 10:30:59    阅读次数:375
UVA 之11729 - Commando War
There is a war and it doesn't look very promising for your country. Now it's time to act. You have a commando squad at your disposal and planning an ambush on an important enemy camp located nearby. Y...
分类:其他好文   时间:2014-05-02 10:28:46    阅读次数:424
UVA之11292 Dragon of Loowater
Problem C: The Dragon of Loowater Once upon a time, in the Kingdom of Loowater, a minor nuisance turned into a major problem. The shores of Rellau Creek in central Loowater had always been a prime...
分类:其他好文   时间:2014-05-02 10:07:09    阅读次数:402
3728条   上一页 1 ... 370 371 372 373 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!