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 ...
分类:
其他好文 时间:
2014-11-26 13:58:49
阅读次数:
255
输入框检测
只允许输入数字,否则红色警示
提交
var textbox=document.forms[0].elements[0];
//获取焦点事件
textbox.onfocus=function(){
if(textbox.style.backgroundColor != "red"){
textbox.style.backgr...
分类:
编程语言 时间:
2014-11-25 23:33:51
阅读次数:
257
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.分析:我们比较熟悉由一个sorted array生成一个BST,不同的是这里的数据...
分类:
其他好文 时间:
2014-11-25 23:01:58
阅读次数:
213
Given an array and a value, remove all instances of that value in place and return the new length.
The order of elements can be changed. It doesn't matter what you leave beyond the new length.
#...
分类:
其他好文 时间:
2014-11-25 16:29:20
阅读次数:
256
原生js 的add函数为下拉菜单增加选项1.object.add(oElement [, iIndex]) index 可选参数:指定元素放置所在的索引号,整形值。如果没有指定值,将添加到集合的最后。想加到最前面,指定索引值0就可以了。@@注意: add方法为js原生方法,属于element元素对....
分类:
其他好文 时间:
2014-11-25 15:52:41
阅读次数:
209
第23章 排序算法Sorting:1sortSort elements in range (function template)2stable_sortSort elements preserving order of equivalents (function template)3partial....
分类:
编程语言 时间:
2014-11-25 12:13:51
阅读次数:
326
【题目】
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.
【解析】
分治:用快慢指针找到链表的中点,作为树的root,然后二分——中点之前的链表和中点之后的链表分别再构造二叉平衡树。
/**
* Defin...
分类:
其他好文 时间:
2014-11-24 22:39:00
阅读次数:
218
Motivation 1)纹理识别(texture recognition) texton: refer to fundamental micro-structures in generic material images and the basic elements in early visual...
分类:
其他好文 时间:
2014-11-24 16:52:58
阅读次数:
132
今天突发奇想,对编码习惯和编程风格很感兴趣,于是乎,找了一下关于编程风格(Java篇)的资料,希望对爱好编码或者开始学习编码的同学有帮助!
来自《The Elements of Java Style》-《Java编程风格》一书,值得一读的书籍,会让你在细节上节省很多时间,合作之间更加愉快!
好处不多说了,但是有几个原则如下:
1.保持原有风格
2.坚持最小惊奇原则
3.第一次就...
分类:
编程语言 时间:
2014-11-24 11:56:53
阅读次数:
280
数据的插入与删除描述:在一组数据(数目不超过10000)中,插入新数,删除所有与给定数相等的数据。输入:第一行是未排序的一组非负整数,数目不超过10000。以-1作为结束标志。第二行是要插入的数。第三行是要删除的数。输出:第一行输出自小到大排好序的数。如果没有元素,输出“No elements.”(...
分类:
其他好文 时间:
2014-11-24 11:38:04
阅读次数:
116