程式設計工藝大師
第一章 緒 論
第二章 演算法效率分析的基本原則
第三章 暴力法
第四章 分解征服法
第五章 縮減征服法
第六章 轉換征服法
第七章 時空取捨法
第八章 動態規劃
第九章 貪婪法
第十章 反覆改進
第十一章 演算法能力的極限
第十二章 超越演算法能力的極限
第四週
1. 10個點,求最短距離的兩個點的座標與距離
0,0
3,0
2,3
0,3
2,0
0,2
4,0
0,4
0,1
1,0
2. 以範例回答T= {a,a,b,a,b,c} p=b(pattern)
public static void main(String[] args) {
// TODO Auto-generated method stub
char T[]={'a', 'a' , 'b'};
char p='a';
for (int i = 0; i < T.length; i++)
{
System.out.print(T[i]); // Display the string.
}
System.out.print("\n"); // Display the string.
for (int i = 0; i < T.length; i++)
{
if (p==T[i])
System.out.print(T[i]); // Display the string.
}
}
3.以範例回答A= {1,2,3,4}位置
k=1;
循序搜尋作業範例
public class HelloWorldApp1 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int[] A={0, 1 , 2, 3, 4};
int k=4;
for (int i = 0; i < A.length; i++)
{
if(A[i]==k)
System.out.println(i); // Display the string.
}
}
}
第三週
一, 選擇排序法與氣泡排序法何者次數較多?
二,
1. blog 說明程式
2. 89 45 68 90 29 34 17
結果以圖檔呈現
3. 修改後程式貼上
public class HelloWorldApp1 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int[] A={5, 4 , 3, 2, 1};
int temp;
for (int j = 0; j < A.length; j++)
{
System.out.println(A[j]); // Display the string.
}
for (int j = 0; j < A.length-1; j++)
{
for (int i = 0; i < A.length-(j+1); i++)
{
temp=A[i+1];
A[i+1]=A[i];
A[i]=temp;
}
}
for (int j = 0; j < A.length; j++)
{
System.out.println(A[j]); // Display the string.
}
}
}
第二週
解決問題
演算法策略
暴力法(Brute Force)
個個擊破法(Divide and Conquer)
貪進法(Greedy Method)
回溯法(Backtracking)
分支設限(Branch and Bound)
當要處理的資料數量非常大時, 演算法效率的好
壞即顯得非常重要
作業
作業
第一週 2010/03/1
製作自己的學習部落格blog
回答下列問題
1.為何why要選修這門課?(動機)
2.希忘從這門課獲得那些知識?(目標)
3.我要如何修習這一門課?(態度與方法)
who, when, where t1 202
如何解題
如何解題How to Solve it!
ppt How to Solve it George Polya
怎樣解題 玻利亞著 蔡坤憲譯