一棵AVL树是其每个节点的左子树和右子树的高度最多差1的二叉查找树。实际高度只比logN多以一点,和普通二叉查找树相比,平衡二叉搜索树一般而言搜寻时间可节省25%左右(STL源码剖析P203)。
只有那些从插入点到根节点的路径上的节点的平衡可能被改变,因为只有这些节点的子树可能发生变化。
把需要重新平衡的节点称为a(左右子树高度差大于1)。注意,确定这个节点很重要,否则无法确定...
分类:
其他好文 时间:
2014-05-10 09:57:21
阅读次数:
406
G++ 2.91.57,cygnus\cygwin-b20\include\g++\stl_stack.h 完整列表
/*
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Permission to use, copy, modify, distribute and sell this software
* and its do...
分类:
其他好文 时间:
2014-05-07 07:40:07
阅读次数:
322
Action代码: public function index(){
$prod = I("get.prod_en");
$id = I("get.id", 0, "int");
if ($prod == ""){
$serviceProduct = array();//多重循环遍历的数组 //数据保存在两张表中,这里通过循环初始化$serviceProduct数组...
分类:
Web程序 时间:
2014-05-07 07:13:02
阅读次数:
440
function FactoryXMLHttpRequest() {
if(window.XMLHttpRequest) {
return new XMLHttpRequest();
}else if(window.ActiveXObject) {
var msxmls = new Array(
'Msxml2.XM...
分类:
其他好文 时间:
2014-05-07 07:00:03
阅读次数:
382
[Question]
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 the two numbers such that they add up to t...
分类:
其他好文 时间:
2014-05-07 05:37:44
阅读次数:
278
一 线性表
1.1 数组
1.1.1 Remove Duplicates from Sorted Array
1.1.2 Remove Duplicates from Sorted Array II
1.1.3 Search in Rotated Sorted Array
1.1.4 Search in Rotated Sorted Array II
1.1.5 Median of...
分类:
其他好文 时间:
2014-05-07 04:24:26
阅读次数:
363
一个依靠STL vector的接口进行申请和回收管理的内存池类( c++ 封装)...
分类:
编程语言 时间:
2014-05-07 04:02:32
阅读次数:
381
package com.array;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import...
分类:
编程语言 时间:
2014-05-07 03:45:11
阅读次数:
365
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).
You are given a target value to search. If found in the array retur...
分类:
其他好文 时间:
2014-05-06 19:03:11
阅读次数:
365
【Question】
Given an array S of n integers, are there elements a, b, c in S such
that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.
Note:
Elements in ...
分类:
其他好文 时间:
2014-05-06 14:57:29
阅读次数:
318