本月博客排行
-
第1名
龙儿筝 -
第2名
lerf -
第3名
fantaxy025025 - johnsmith9th
- zysnba
- xiangjie88
年度博客排行
-
第1名
青否云后端云 -
第2名
宏天软件 -
第3名
gashero - wy_19921005
- vipbooks
- benladeng5225
- e_e
- wallimn
- javashop
- ranbuijj
- fantaxy025025
- jickcai
- gengyun12
- zw7534313
- qepwqnp
- 解宜然
- ssydxa219
- zysnba
- sichunli_030
- sam123456gz
- 龙儿筝
- arpenker
- tanling8334
- kaizi1992
- gaojingsong
- xpenxpen
- jh108020
- wiseboyloves
- ganxueyun
- xyuma
- xiangjie88
- wangchen.ily
- Jameslyy
- lemonhandsome
- luxurioust
- jbosscn
- mengjichen
- zxq_2017
- lzyfn123
- nychen2000
- forestqqqq
- wjianwei666
- ajinn
- zhanjia
- Xeden
- hanbaohong
- java-007
- 喧嚣求静
- kingwell.leng
- mwhgJava
最新文章列表
USACO Dual Palindromes 题解
一天水了两题,呵呵,题目确实挺水的
做完上一题,这一题已经毫无难度可言了,只改了点代码
诸位凑合看:
/*
ID: bbsunch2
PROG: dualpal
LANG: C++
*/
#include <iostream>
#include <fstream>
#include <string>
#include <vector& ...
USACO Palindromic Squares 源码
这题很容易的,依然是暴力搜索,好吧,这一章都叫complete search
要点就两个,一个是进制转换,一个是ASCII码转换(当然你要想用数组来搞也是没什么问题的)
难道就是在告诉你,暴力搜索才是你最需要care的么?!
下面上我的代码:
/*
ID: bbsunch2
PROG: palsquare
LANG: C++
*/
#include <iostream> ...
PHP 选择排序 算法 经典面试题
<?php
$unsorted = array();
for ($i = 0; $i < 10; $i++) {
$unsorted[] = rand(0,1000);
}
print "Unsorted Array. <br />";
print implode(',', $unsorted);
print "&l ...
PHP 排序冒泡算法 经典面试题
<?php
$unsorted = array();
for ($i = 0; $i < 10; $i++) {
$unsorted[] = rand(0,1000);
}
print "Unsorted Array. <br />";
print implode(',', $unsorted);
print " ...
Heap
1. A heap is a container for objects that have keys. Supported Operations:
a) Insert ---- Add a new object to a heap. Running time : (O(logn))
b) Extract-Min ---- remove ...
Introduction to Graph Search
1. A few motivations for Graph Search:
a) check if a network is connected ( can get to anywhere from anywhere else)
b) driving direction
c) formulate a plan ( the nodes are the ste ...
Random Contraction Algorithm
1. Two ingredients of Graph:
a) vertices A.K.A. nodes (V)
b) edges = pairs of vertices (E)
can be undirected or directed A.K.A arcs
2. Definition of Cuts of Graphs:
A ...
Probability Review
1. Sample space Ω = "All possible out comes".
Each outcome i in Ω , has a probability P(i) >= 0;
Constraint : Sum(i in Ω) {P(i)} = 1.
2. Choosing a random pivot in outer Q ...
QuickSort Analysis
1. Average Running Time of QuickSort:
For every input array of length n , the average running time of QuickSort (with random pivots) is O(nlogn).
Note: It holds for every input, no assumption on ...
A星算法原理【转】- 下篇
在A星算法的上一篇,我们已经大致明白了该算法的过程,现在让我们看看它具体是怎么运作的。我们最初的9格方格中,在起点被切换到关闭列表中后,还剩8格 留在开启列表中。这里面,F值最低的那个是起始格右侧紧邻的格子,它的F值是40。因此我们选择这一格作为下一个要处理的方格。在紧随的图中,它被用蓝色 突出显示。
[图4]
首先,我们把它从开启列表中取出,放入关闭 ...
Beautiful Quicksort
void quicksort(int l, int u){
if(l >= u) return;
swap(l,rand(l,u));
int m = l;
for(int i = l+1; i<= u; i++) if(x[i] < x[l])
swap(++m, i);
swap(l, m);
...
Master Method
1. Assumption:
a) Base Case : T(n) <= a constant for all sufficiently small n
b) For all sufficiently large n : T(n) <= a T(n/b) + O(n^d) , where:
i) a = number of recurs ...
Introduction
1. Why Study Algorithms
a) important for all other branches of computer science b) plays a key role in modern technological innovation c) provides novel “lens” on processes outside of compute ...
KMP算法
//先上程序,关键是理解思想。
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;
char p[1000], s[1000];
...