Skip to content

Instantly share code, notes, and snippets.

@goctave
goctave / main.cpp
Created May 6, 2012 02:43
CareerCup_4.1@1point3acres
/*****************************************************************
Implement a function to check if a tree is balanced
For the purposes of this question, a balanced tree is
defined to be a tree such that no two leaf Nodes differ
in distance from the root by more than one
******************************************************************/
#include <iostream>
@goctave
goctave / main.cpp
Created May 9, 2012 03:11
CareerCup_4.3@1point3acres
//
// main.cpp
// cc4_3
//
// Created by gsw on 12-5-9.
// Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//
/******************************************************************************
* Given a sorted (increasing order) array, write an algorithm to create a
@goctave
goctave / gist:ec28fbdd48cd0f7f477a4761fdeec08c
Created December 12, 2016 02:05 — forked from methane/gist:2185380
Tornado Example: Delegating an blocking task to a worker thread pool from an asynchronous request handler
from time import sleep
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
from tornado.web import Application, asynchronous, RequestHandler
from multiprocessing.pool import ThreadPool
_workers = ThreadPool(10)
def run_background(func, callback, args=(), kwds={}):
def _callback(result):