parentNode跟parentElement除了前者是w3c标准,后者只ie支持当父节点的nodeType不是1,即不是element节点的话,它的parentElement就会是null一般情况parentNode可以取代parentElement的所有功能parentElement匹配的是p...
分类:
其他好文 时间:
2014-11-12 13:34:17
阅读次数:
179
1.原文问题描述:Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto stack.pop() -...
分类:
其他好文 时间:
2014-11-11 14:08:11
阅读次数:
168
缓存变量
DOM遍历是昂贵的,所以尽量将会重用的元素缓存。
// 糟糕
h = $('#element').height();
$('#element').css('height',h-20);
// 建议
$element = $('#element');
h = $element.height();
$element.css('hei...
分类:
Web程序 时间:
2014-11-11 12:48:24
阅读次数:
256
Remove Duplicates from Sorted ArrayGiven a sorted array, remove the duplicates in place such that each element appear onlyonceand return the new lengt...
分类:
其他好文 时间:
2014-11-11 12:22:39
阅读次数:
144
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto stack.pop() -- Removes...
分类:
其他好文 时间:
2014-11-11 07:05:12
阅读次数:
190
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto stack.pop() -- Removes...
分类:
其他好文 时间:
2014-11-10 23:13:29
阅读次数:
277
一共用两个栈。一个用来放数据,另一个专门用来存放当前最小值。 1 class MinStack { 2 public: 3 void push(int x) { 4 elements.push(x); 5 if (mins.empty()||x element...
分类:
其他好文 时间:
2014-11-10 19:45:57
阅读次数:
143
Arrays of Length Zero 这样说: Zero-length arrays are allowed in GNU C. They are very useful as the last element of a structure that is really a header fo...
分类:
编程语言 时间:
2014-11-10 19:22:07
阅读次数:
225
Min StackDesign a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto stack.pop() -...
分类:
其他好文 时间:
2014-11-10 17:11:24
阅读次数:
174
GL_ARRAY_BUFFER(表示顶点数据)GL_ELEMENT_ARRAY_BUFFER(表示索引数据)GL_PIXEL_UNPACK_BUFEER( 表示传递给O p e n G L 的像素数据)GL_PIXEL_PACK_BUFFER(表示从OpenGL获取的像素数据)GL_COPY_REA...
分类:
其他好文 时间:
2014-11-10 15:28:22
阅读次数:
191