Algorithm
文章平均质量分 73
Yuli_Derek
我不去想是否能够成功 既然选择了远方 便只顾风雨兼程 我不去想能否赢得爱情 既然钟情于玫瑰 就勇敢地吐露真诚 我不去想身后会不会袭来寒风冷雨 既然目标是地平线 留给世界的只能是背影 我不去想未来是平坦还是泥泞 只要热爱生命 一切都在意料之中
展开
-
【Python排序搜索基本算法】之快速排序(QuickSort)
def choosePivot(number, l, r): #choose the first element as the Pivot p = l return pdef partition(number, l, r, p): number[l], number[p] = number[p], number[l] #swap the lth number a原创 2013-07-22 22:11:27 · 1560 阅读 · 0 评论 -
【Python排序搜索基本算法】之归并排序&分治法(Merge Sort and Divide & Conquer)
Merge Sort is a good introduction to divide & conquer.The Big O of Merge Sort Algorithm is O(nlog(n)).The divide & conquer Paradigm1. Divide into small subproblems2. Conquer via recursive原创 2013-07-14 21:50:36 · 1503 阅读 · 0 评论 -
【Python排序搜索基本算法】之无向图的最小割&Karger算法(Graphs and Minimum Cuts & Karger's Min-Cut Algorithm)
Graphs Two ingredients 1. vertices (nodes) v 2. edges(undirected or directed)Examples: road networks, the web, social networksThe minimum Cut problem Input: undirected g原创 2013-08-02 19:37:52 · 4671 阅读 · 2 评论 -
【Python排序搜索基本算法】之深度优先搜索、广度优先搜索、拓扑排序、强联通&Kosaraju算法
Graph Search and Connectivity Generic Graph Search Goals 1. find everything findable 2. don't explore anything twice Generic Algorithm (given graph G, vertex S)原创 2013-08-09 15:47:17 · 2428 阅读 · 0 评论 -
【Python排序搜索基本算法】之Dijkstra最短路径算法(Dijkstra's Shortest-Path Algorithm)
Single-Source shortest PathsInput directed graph G = (V,E) (m = |E|, n = |V|) ---each edge has nonnegative length ---source vertex soutput: for each v, compute L(v) = length of a sho原创 2013-08-13 20:57:15 · 3631 阅读 · 0 评论