红黑树是建立在二叉查找树的基础之上的,关于二叉查找树可以参看【算法导论】二叉搜索树的插入和删除和【算法导论】二叉树的前中后序非递归遍历实现。对于高度为h的二叉查找树而言,它的SEARCH、INSERT、DELETE、MINIMUM、MAXIMUM等操作的时间复杂度均为O(h)。所以在二叉查找树的高度较高时,上述操作会比较费时,而红黑树就可以解决这种问题。...
分类:
编程语言 时间:
2015-01-14 12:49:51
阅读次数:
1480
题目:Given two wordsword1andword2, find the minimum number of steps required to convertword1toword2. (each operation is counted as 1 step.)You have the ...
分类:
其他好文 时间:
2015-01-14 06:16:13
阅读次数:
198
width - viewport的宽度 height - viewport的高度initial-scale - 初始的缩放比例minimum-scale - 允许用户缩放到的最小比例maximum-scale - 允许用户缩放到的最大比例user-scalable - 用户是否可以手动缩放width...
分类:
Web程序 时间:
2015-01-13 17:21:46
阅读次数:
157
Follow up for "Find Minimum in Rotated Sorted Array":
What if duplicates are allowed?
Would this affect the run-time complexity? How and why?
Suppose a sorted array is rotated at some pivot u...
分类:
其他好文 时间:
2015-01-12 21:04:07
阅读次数:
224
Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.
Note: You can only move either down or right at...
分类:
其他好文 时间:
2015-01-12 16:31:05
阅读次数:
180
题目:Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).Find the minimum elemen....
分类:
编程语言 时间:
2015-01-12 06:47:23
阅读次数:
173
Unique Paths https://oj.leetcode.com/problems/unique-paths/ A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram b...
分类:
其他好文 时间:
2015-01-11 21:30:24
阅读次数:
319
Easy Task
Time Limit: 2 Seconds Memory Limit: 65536 KB
You are given n integers. Your task is very easy. You should find the maximum integer a and the minimum integer b among these n inte...
分类:
其他好文 时间:
2015-01-11 20:24:46
阅读次数:
242
The problem 1:Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to t...
分类:
其他好文 时间:
2015-01-11 06:07:49
阅读次数:
216
Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)
You have the following 3 operations permitted on a word:
a) Insert a character
b) Delete a character
c) Replace a...
分类:
其他好文 时间:
2015-01-10 18:15:43
阅读次数:
181