Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
static int hash(int num, int k) {// k个不同元素的全排列的hash函数。s是K个元素的一个排列 | |
int n[] = new int [k]; | |
for (int i = k - 1 ; i >= 0; i--) { | |
n[i] = num % 10; | |
num /= 10; | |
} | |
int key = 0; | |
int c; | |
for (int i = 1 ; i < k; i++) { |
class SortTask extends RecursiveAction { | |
final long[] array; | |
final int lo; | |
final int hi; | |
private int THRESHOLD = 30; | |
public SortTask(long[] array) { | |
this.array = array; | |
this.lo = 0; | |
this.hi = array.length - 1; |
int heap[MAX_N],sz = 0; | |
void push(int x){ | |
int i = sz++; | |
while(i>0){ | |
int p = (i-1)/2; | |
if(heap[p] <= x)break; | |
heap[i] = heap[p]; | |
i=p; | |
} | |
int L,P,N; | |
int A[MAX_N+1],B[MAX_N+1]; | |
void solve(){ | |
A[N] = L; | |
B[N] = 0; | |
N++; | |
priority_queue<int> que; | |
Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
{ | |
"name":"acme/blog", | |
"repositories": [ | |
{ | |
"type":"composer", | |
"url":"http://packages.example.com" | |
}, | |
{ | |
"type":"composer", |
import sublime, sublime_plugin | |
import os, string, re | |
class DetectFileTypeCommand(sublime_plugin.EventListener): | |
""" Attempts to choose the correct syntax when more than one could apply. """ | |
def __init__(self): | |
super(DetectFileTypeCommand, self).__init__() | |
self.path = None |
// Original method | |
var object = { | |
method: function (x, y) { | |
return x+y; | |
} | |
} | |
// Add operations before or after! | |
object.method = (function (original) { | |
return function (x, y) { |
angular.module('myApp.services', []) | |
.factory('UserFactory', function($http, $q) { | |
var service = { | |
// our factory definition | |
user: {}, | |
setName: function(newName) { | |
service.user['name'] = newName; | |
}, | |
setEmail: function(newEmail) { | |
service.user['email'] = newEmail; |
function Player(name){ | |
this.pointer = 0; | |
this.name = name; | |
} | |
Player.prototype.play = function(){ | |
this.points +=1; | |
mediator.played(); | |
}; |