原创 Lecture 5 Sorting Algorithm

How fast can we sort?  Depends on the computational model of what you can do with the elements. Comparison sorting mo

原创 Lecture 9 Random built Binary Search Trees BSTs

Random built Binary Search Trees  BSTs    E[hight] near 3logn Quick Sort? Relation to Quick Sort: BST sort & Qu

原创 ZooKeeper編程02--多線程的分佈式鎖

面向過程版: package distributedLockProcess; import java.util.Collections; import java.util.List; import java.util.concurren

原创 07 模塊

  模塊和包的概念 等同於java中的Package 模塊名=文件名(無後綴) 在文件系統中,包就是文件夾,模塊就是xxx.py文件 每層包下面都有__init__.py文件   導入模塊 >>> import math >>> math

原创 Lecture 3 Divide and Conquer

1.Divide the problem(instance) into one or more sub-problem; 2.Conquer each sub-problem recursively; 3.Combine solution

原创 06 函數式編程

1 函數式編程簡介 函數:function 函數式:functional 一種編程範式   特點: 把計算視爲函數而非指令 純函數式編程:不需要變量,沒有副作用,測試簡單 支持高階函數,代碼簡潔   Python支持的函數式編程: 不是純

原创 03 控制語句

if語句 if age >= 18     print 'your age is', age else     print 'teenager' Python代碼的縮進規則:具有相同縮進的代碼被視爲代碼塊。   if age >= 18

原创 Lecture 7 Hashing Table I

Hash |---Hash function:  Division, Multiplication |---Collision:  Chaining, Open addressing(Linear,Double hasing)     S

原创 09 類的繼承

  繼承一個類 class Person(object):     def __init__(self, name, gender):         self.name = name         self.gender = gend

原创 Lecture 8 Hashing II

Weakness of hashing: For any choice of hash function, exists bad set of keys that all hash to same slot. Idea:Choose ha

原创 01 Python變量和數據類型

Python變量和數據類型 1 數據類型 計算機,顧名思義就是可以做數學計算的機器,因此,計算機程序理所當然也可以處理各種數值。 但是,計算機能處理的遠不止數值,還可以處理文本、圖形、音頻、視頻、網頁等各種各樣的數據,不同的數據需要定義不

原创 Lecture 1 Analysis of Algorithms

Analysis of Algorithms The theoretical study of computer program performance and resource usage. Performance: time Res

原创 QT Linux打包發佈

Linux: 1、用Release編譯; 2、把可執行文件(如paike)放入新建目錄中; 3、當前目錄下編寫腳本copyDependency.sh,把動態鏈接庫導入當前目錄; #!/bin/sh exe="paike" #發佈的

原创 Lecture 12 Skip Lists [Pugh 1989]

---simple efficient dynamic randomized search structure ---others: Treap[1993]  RB-Trees  B-Trees ---O(logn) in expecta

原创 02 CSS

使用 table 進行佈局存在缺陷,而一般的佈局都會採用 DIV+CSS 來進行佈局。 Div 它是一個html 標籤,一個塊級元素(單獨顯示一行)。它單獨使用沒有任何意義,必須結合 CSS 來使用。它主要用於頁面的佈局。  Span 它