题目链接:Recover Binary Search Tree
Two elements of a binary search tree (BST) are swapped by mistake.
Recover the tree without changing its structure.
Note:
A solution using O(n) space is pretty stra...
分类:
其他好文 时间:
2015-04-14 21:39:52
阅读次数:
189
1. 穷举法 基本思想:列举问题的所有可能解,并用约束条件逐一进行判定,找出符合约束条件的解。 穷举法的关键在于问题的可能解的列举和可能解的判别。 例如:凑数问题2. 递归技术 定义:直接或间接调用自身的过程 递归三要素: (1)问题形式:返回结果是什么?需要哪些入口参数? (2)递归规...
分类:
编程语言 时间:
2015-04-14 16:34:33
阅读次数:
203
给定n个权值作为n的叶子结点,构造一棵二叉树,若带权路径长度达到最小,称这样的二叉树为最优二叉树,也称为哈夫曼树(Huffman tree)。哈夫曼树是带权路径长度最短的树,权值较大的结点离根较近。1、路径和路径长度 在一棵树中,从一个结点往下可以达到的孩子或孙子结点之间的通路,称为路径。通路中分....
分类:
其他好文 时间:
2015-04-14 14:33:20
阅读次数:
96
Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations:
get and set.
get(key) - Get the value (will always be positive) of the key if t...
分类:
系统相关 时间:
2015-04-14 13:04:48
阅读次数:
185
/** * ID: 24 * Name: Swap Nodes in Pairs * Data Structure: Linked List * Time Complexity: * Space Complexity: * Tag: LinkList * Difficult: Medium ...
分类:
其他好文 时间:
2015-04-14 07:10:45
阅读次数:
127
/** * ID: 92 * Name: Reverse Linked List * Data Structure: Linked List * Time Complexity: * Space Complexity: * Tag: LinkList * Difficult: Medium ...
分类:
其他好文 时间:
2015-04-14 07:04:18
阅读次数:
192
网站:http://redis.io/ key-value cache and store data structure server 1. 服务器端 1.1 安装 下载安装包:http://redis.io/download 解压之后make即可。 $ wget http://download.r...
分类:
其他好文 时间:
2015-04-13 14:18:56
阅读次数:
116
/** * ID: 2 * Name: Add Two Numbers * Data Structure: Linked List * Time Complexity: * Space Complexity: * Tag: LinkList * Difficult: Medium * Pro...
分类:
其他好文 时间:
2015-04-13 06:54:00
阅读次数:
169
Q: What is a class?A: A class is an expanded concept of a data structure: instead of holding only data, it can hold both data and functions.Q: What ar...
分类:
编程语言 时间:
2015-04-12 20:59:27
阅读次数:
238
在web相关技术中,HTML代表了content,structure, CSS则负责styling,决定内容是如何展示的,javascript则主要负责interactive, behaviour。在网站开发中一般流程就是先写html初步决定page的结构和内容,然后定义css应用到网页,调整展示的...
分类:
Web程序 时间:
2015-04-12 18:59:18
阅读次数:
178