編程題(15_01.c) 結構 struct student { long num char name[20] int score struct student *next } 鏈表練習: (1).編寫函數struct student * creat(int n),創建一個按學號升序排列的新鏈表,每個鏈表中的結點中 的學號、成績由鍵盤輸入,一共n個節點。 (2).編寫函數void print(struct student *head),輸出鏈表,格式每行一個結點,包括學號,姓名,分數。 (3).編寫函數struct student * merge(struct student *a,struct student *b), 將已知的a,b兩個鏈表 按學號升序合并,若學號相同則保留成績高的結點。 (4).編寫函數struct student * del(struct student *a,struct student *b),從a鏈表中刪除b鏈表中有 相同學號的那些結點。 (5).編寫main函數,調用函數creat建立2個鏈表a,b,用print輸出倆個鏈表;調用函數merge升序合并2個 鏈表,并輸出結果;調用函數del實現a-b,并輸出結果。 a: 20304,xxxx,75, 20311,yyyy,89 20303,zzzz,62 20307,aaaa,87 20320,bbbb,79 b: 20302,dddd,65 20301,cccc,99 20311,yyyy,87 20323,kkkk,88 20307,aaaa,92 20322,pppp,83
上傳時間: 2016-04-13
上傳用戶:zxc23456789
此小程序用java實現了可以分割的背包問題,開發平臺是Eclipse。其中主要是用貪心算法實現背包問題,在將物品進行排序時,沒有使用經典的merge-sort算法,而是直接使用了java中Arrays類的sort的方法,但要自己定義類,實現接口Comparator。
上傳時間: 2013-12-20
上傳用戶:kbnswdifs
LINUX下的文件比較工具,和WINDOWS下的merge工具差不多
上傳時間: 2013-12-24
上傳用戶:hewenzhi
Input : A set S of planar points Output : A convex hull for S Step 1: If S contains no more than five points, use exhaustive searching to find the convex hull and return. Step 2: Find a median line perpendicular to the X-axis which divides S into SL and SR SL lies to the left of SR . Step 3: Recursively construct convex hulls for SL and SR. Denote these convex hulls by Hull(SL) and Hull(SR) respectively. Step 4: Apply the merging procedure to merge Hull(SL) and Hull(SR) together to form a convex hull. Time complexity: T(n) = 2T(n/2) + O(n) = O(n log n)
標簽: contains Output convex planar
上傳時間: 2017-02-19
上傳用戶:wyc199288
Creating barcodes in Microsoft廬 Office has never been easier. With BarCodeWiz Toolbar you can add barcodes to Microsoft廬 Office applications with a click of a button. In Microsoft廬 Word, create single barcodes, pages of labels, or mail merge documents. In Microsoft廬 Excel廬, select a range of cells and automatically convert each cell to a barcode. In Microsoft廬 Access廬, create reports with barcodes based on your data tables.
標簽: BarCodeWiz Microsoft Creating barcodes
上傳時間: 2013-12-18
上傳用戶:asddsd
此文件夾中共包括十二個小程序 AVL創建平衡二叉樹,通過加入一個個的結點創建,并實現了平衡二叉樹中的結點刪除 Boyer_Moore算法的串模式匹配 Horspool算法的串模式匹配 Graph實現了有向圖的非遞歸廣度優先遍歷及非遞歸深度優先遍歷 HeapSort利用堆排序實現優先級隊列 merge實現二路歸并排序算法 MFK動態規劃解背包問題 nqueue求解n皇后問題 QuickSort快速排序算法的實現。 Shell排序算法的實現。 Tree程序中實現了先序\中序\后序遍歷二叉樹的非遞歸算法。 tubao用遞歸法解決突包問題
標簽: Boyer_Moore Horspool Grap AVL
上傳時間: 2017-08-08
上傳用戶:佳期如夢
1.Describe a Θ(n lg n)-time algorithm that, given a set S of n integers and another integer x, determines whether or not there exist two elements in S whose sum is exactly x. (Implement exercise 2.3-7.) #include<stdio.h> #include<stdlib.h> void merge(int arr[],int low,int mid,int high){ int i,k; int *tmp=(int*)malloc((high-low+1)*sizeof(int)); int left_low=low; int left_high=mid; int right_low=mid+1; int right_high=high; for(k=0;left_low<=left_high&&right_low<=right_high;k++) { if(arr[left_low]<=arr[right_low]){ tmp[k]=arr[left_low++]; } else{ tmp[k]=arr[right_low++]; } } if(left_low<=left_high){ for(i=left_low;i<=left_high;i++){ tmp[k++]=arr[i]; } } if(right_low<=right_high){ for(i=right_low;i<=right_high;i++) tmp[k++]=arr[i]; } for(i=0;i<high-low+1;i++) arr[low+i]=tmp[i]; } void merge_sort(int a[],int p,int r){ int q; if(p<r){ q=(p+r)/2; merge_sort(a,p,q); merge_sort(a,q+1,r); merge(a,p,q,r); } } int main(){ int a[8]={3,5,8,6,4,1,1}; int i,j; int x=10; merge_sort(a,0,6); printf("after Merging-Sort:\n"); for(i=0;i<7;i++){ printf("%d",a[i]); } printf("\n"); i=0;j=6; do{ if(a[i]+a[j]==x){ printf("exist"); break; } if(a[i]+a[j]>x) j--; if(a[i]+a[j]<x) i++; }while(i<=j); if(i>j) printf("not exist"); system("pause"); return 0; }
上傳時間: 2017-04-01
上傳用戶:糖兒水嘻嘻