Skip to content

Instantly share code, notes, and snippets.

@jizhilong
jizhilong / kmp.cpp
Created October 4, 2013 10:36
Knuth-Morris-Pratt Algorithm
/*
* =====================================================================================
*
* Filename: kmp.cpp
*
* Description: Knuth-Morris-Pratt Algorithm
*
* Version: 1.0
* Created: 10/04/2013 06:15:30 PM
* Revision: none
@jizhilong
jizhilong / rbtree.cpp
Created October 4, 2013 02:01
a implementation of red-black tree in cpp
/*
* =====================================================================================
*
* Filename: rbtree.cpp
*
* Description: red-black tree in cpp
*
* Version: 1.0
* Created: 10/03/2013 11:38:50 PM
* Revision: none
@jizhilong
jizhilong / heap.h
Created October 1, 2013 06:54
a generic heap implemented in c++ template.
#include <vector>
#include <algorithm>
using std::vector;
using std::swap;
template <typename T>
class heap
{
public:
@jizhilong
jizhilong / sorts.cpp
Last active December 24, 2015 06:49
basic sorting algorithms implemented in C.
/*
* =====================================================================================
*
* Filename: sorts.c
*
* Description: basic sorting algorithms
*
* Version: 1.0
* Created: 09/23/2013 03:58:30 PM
* Revision: none
@jizhilong
jizhilong / tree.cpp
Last active December 24, 2015 04:38
the 3 ways of iterating a binary tree.
/*
* =====================================================================================
*
* Filename: tree.cpp
*
* Description: some operations with binary tree
*
* Version: 1.0
* Created: 09/29/2013 01:16:19 AM
* Revision: none
@jizhilong
jizhilong / kill_child_processes.py
Created September 24, 2013 16:37
how to kill a process's child processes in python
#!/usr/bin/env python
import multiprocessing
import time
import subprocess, os, signal, sys
def test(s):
while True:
print s
time.sleep(1.5)