Presentation is loading. Please wait.

Presentation is loading. Please wait.

DaTA STRUCTURE 課程簡介 Lai Ah Fur 2003/2/20. Input Output Process Algorithm+Data Structures.

Similar presentations


Presentation on theme: "DaTA STRUCTURE 課程簡介 Lai Ah Fur 2003/2/20. Input Output Process Algorithm+Data Structures."— Presentation transcript:

1 DaTA STRUCTURE 課程簡介 Lai Ah Fur 2003/2/20

2 Input Output Process Algorithm+Data Structures

3 Data structures 資料項之間的關係 線性: linked list, Queue,Stack 階層 :Tree(BST,B-tree,AVL tree,..) 網狀 :graph (network,circuit)

4 資料結構重點 linked list , queue , stack , tree , graph , heap , hash table 、 sort 、 search 等特性、 基本演算法、實作 ( 含 RECURSIVE) 、實 際應用及時間 / 空間複雜度

5 學習要領 : 天下沒有白吃的午餐 上課認真聽講, 不懂立刻發問, 務求徹底了 解 下課當天一定要複習 習題自己設計不抄他人, 三天完成, 一周內 完美化 同學間相互討論, 共同成長 思索 : 想學東西或只要高分 ? 或二者都要 ? 二樣皆屬於認真者

6 學習目的 Kernel Course Promote programming skill Entrance examination

7 Evaluation mid & final Test: 60% 術科實作考試: 15% Homework: 20% Attendance & discussion: 5%

8 bubble sort for integer static int[] bubbleSort(int[] a) { int t; for (int i=0; ia[j+1]) { t=a[j]; a[j]=a[j+1]; a[j+1]=t; } } return a; }

9 bubble sort for string String t; int n = args.length; for (int i=0; i 0) { t=a[j]; a[j]=a[j+1]; a[j+1]=t; }

10 Selection sort-1 static void sort(String name[],int ary[],int n) { int temp=100; String st=""; for(int i=0;i<=n-2;i++) //0..n-2=n-1 pass for(int j=i+1;j<=n-1;j++) { if (ary[i]<=ary[j]) { temp=ary[i];ary[i]=ary[j];ary[j]=temp; st=name[i];name[i]=name[j];name[j]=st; } }}

11 Selection sort-2 static void sort(String name[],int ary[],int n) { int temp=100,min=0; String st=""; for(int i=0;i<=n-2;i++) //0..n-2=n-1 pass { min=i; for(int j=i+1;j<=n-1;j++) { if (ary[i]<=ary[j]) min=j; } temp=ary[i];ary[i]=ary[j];ary[j]=temp; st=name[i];name[i]=name[j];name[j]=st; }

12 Linear search static int linearsearch(int num,int n) { int findno=-1; for(int i=0;i<=n-1;i++) if (sc[i] ==num) { findno=i;break;} return (findno); }

13 Binary search static int binarysearch(int refsc[],int num) { int low=0,mid=0,high=0; high=refsc.length-1; while (low<=high) { mid=(int)((low+high)/2); if (refsc[mid]num) high=mid-1; else return (mid); }//while return (-1); //not found!! }

14 static int Rbinarysearch (int refsc[],int num,int low, int high ) { int mid=0; mid=(int)((low+high)/2); if (low>high) return (-1); //not found!! else if (refsc[mid]num) //Asce return ( Rbinarysearch (refsc,num,low,mid-1)); else //if (refsc[mid]==num) return (mid)); }// Rbinarysearch


Download ppt "DaTA STRUCTURE 課程簡介 Lai Ah Fur 2003/2/20. Input Output Process Algorithm+Data Structures."

Similar presentations


Ads by Google