var appElement = document.querySelector('[ng-controller=seatsCtrl]');var $scope = angular.element(appElement).scope();$scope.$apply(function () { $sco...
分类:
Web程序 时间:
2014-06-26 20:12:05
阅读次数:
551
package com.unbank.robotspider.util;import java.util.HashMap;import java.util.Map;import org.jsoup.nodes.Document;import org.jsoup.nodes.Element;impor...
分类:
其他好文 时间:
2014-06-26 19:07:20
阅读次数:
204
??
当大多数程序员需要对一组对象进行排序的时候,首先想到的一个算法是sort。sort是一个非常不错的算法,但它也并非在任何场合下都是完美无缺的。有时候我们并不需要一个完全的排序操作。比如说,如果我们有一个存放Widget的矢量,而我们希望将质量最好的20个Widget送给最重要的顾客,按照顾客的重要程度送上不同质量的Widget,那么只需要排序出前20个最好的Widget,其他的Widget...
分类:
其他好文 时间:
2014-06-26 14:10:39
阅读次数:
185
【题目】
Given an array of integers, every element appears twice except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?
【题意】
给定一个整数数组,其中除了一个数以外,其他数都是成对出现的,...
分类:
其他好文 时间:
2014-06-26 10:13:27
阅读次数:
254
题目:数组中有一个数字出现的次数超过数组长度的一半,请找出这个数字方法一:如果把这个数字排序,那么排序之后位于数组中间的数字一定就是出现次数超过数组长度一半的数字这个数字就是统计学中的中位数,即长度为n的数组中第n/2大的数字在数组中得到任意第k大数字,这一问题有O(n)解,注:这里第kth个元素,...
分类:
其他好文 时间:
2014-06-25 16:47:12
阅读次数:
345
/*求二叉树中距离最远的两个点 * 基本思路: * 递归计算两棵树的最大高度,设置一个全局变量,距离最远的两个节点element * 其中:在计算左子支,直接刷新上述全局变量,在计算右边子支时,设置两个临时Node变量,变量里的element用于 * 保存右边子支的两个最远距离。根据比较两个距离的大...
分类:
其他好文 时间:
2014-06-25 14:54:59
阅读次数:
247
一.DB(Data block)A data block is the smallest unit of storage in anOracledatabase. Every database has a default block size (specified when the database...
分类:
数据库 时间:
2014-06-25 14:20:00
阅读次数:
430
使用device.js检测设备并实现不同设备展示不同网页html代码: 引入device.js(function() { var previousDevice, _addClass, _doc_element, _find, _handleOrientation, _hasClass...
分类:
移动开发 时间:
2014-06-25 14:07:19
阅读次数:
275
题目:输入n个整数,找出其中最小的K个数方法一:直接std::sort,T(n) = O(nlgn)方法二:直接std::nth_element T(n) = O(n) 但是修改了原数组void MinKth(std::vector& num, int kth, std::vector& resul...
分类:
其他好文 时间:
2014-06-25 12:35:07
阅读次数:
216
/**
* Method 1: Delete the input element x
* and meanwhile keep the length of array after deleted n
* @param a the array
* @param n the length of array after deleted.
* @param x the element t...
分类:
其他好文 时间:
2014-06-25 08:27:27
阅读次数:
171