Skip to content

Instantly share code, notes, and snippets.

@bobozhengsir
bobozhengsir / SkipSet.java
Created September 24, 2014 09:52
Understand Skip List data structure
/*
** Learn the data structure <Skip List>
** see also http://en.literateprograms.org/Skip_list_(Java)
*/
class SkipNode<E extends Comparable<? super E>> {
public final E value;
public final SkipNode<E>[] forward; // array of pointers
@SuppressWarnings("unchecked")
$(document).ready(function() {
// Support for AJAX loaded modal window.
// Focuses on first input textbox after it loads the window.
$('[data-toggle="modal"]').click(function(e) {
e.preventDefault();
var url = $(this).attr('href');
if (url.indexOf('#') == 0) {
$(url).modal('open');
} else {
@bobozhengsir
bobozhengsir / rad
Last active August 29, 2015 13:59
a question
"""
45度角打印矩阵,示例如下:
<--------x,y(0,0)
1 2 3 4 5|
6 7 8 9 a|
b c d e f|
_
打成:
#!/usr/bin/env scala
!#
import scala.collection.mutable.Map
import java.io._
val rootDir = new File(args(0))
if (!rootDir.exists) throw new IllegalArgumentException(rootDir + " dose not exist")
@bobozhengsir
bobozhengsir / crawlRemainTickets
Created September 26, 2013 11:50
每隔一段时间抓取12306余票信息
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import urllib
import urllib2
import json
import re
import time
import datetime
import csv
@bobozhengsir
bobozhengsir / MinMax.java
Created September 26, 2013 03:13
get the max and min of list
package com.example;
import java.util.ArrayList;
import java.util.List;
public class MinMax<T extends Comparable<T>> {
private List<T> lst = null;
public MinMax(List<T> com)
@bobozhengsir
bobozhengsir / classical.js
Last active December 14, 2015 11:49
JavaScript techniques for Creating Object/ JavaScript 创建对象方法
/*******************************************
* 参考http://howtonode.org/object-graphs-2
* *****************************************/
/**
* 方法一:典型构造器方法
*/
function Rectangle(width, height) {
this.width = width;
this.height = height;
}