實驗源代碼 //Warshall.cpp #include<stdio.h> void warshall(int k,int n) { int i , j, t; int temp[20][20]; for(int a=0;a<k;a++) { printf("請輸入矩陣第%d 行元素:",a); for(int b=0;b<n;b++) { scanf ("%d",&temp[a][b]); } } for(i=0;i<k;i++){ for( j=0;j<k;j++){ if(temp[ j][i]==1) { for(t=0;t<n;t++) { temp[ j][t]=temp[i][t]||temp[ j][t]; } } } } printf("可傳遞閉包關系矩陣是:\n"); for(i=0;i<k;i++) { for( j=0;j<n;j++) { printf("%d", temp[i][ j]); } printf("\n"); } } void main() { printf("利用 Warshall 算法求二元關系的可傳遞閉包\n"); void warshall(int,int); int k , n; printf("請輸入矩陣的行數 i: "); scanf("%d",&k); 四川大學實驗報告 printf("請輸入矩陣的列數 j: "); scanf("%d",&n); warshall(k,n); }
上傳時間: 2016-06-27
上傳用戶:梁雪文以
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.)
上傳時間: 2017-04-01
上傳用戶:糖兒水嘻嘻
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
上傳用戶:糖兒水嘻嘻
% Computation of ST-ZCR and STE of a speech signal. % % Functions required: zerocross, sgn, winconv. % % Author: Nabin Sharma % Date: 2009/03/15 [x,Fs] = wavread('so.wav'); % word is: so x = x.'; N = length(x); % signal length n = 0:N-1; ts = n*(1/Fs); % time for signal % define the window wintype = 'rectwin'; winlen = 201; winamp = [0.5,1]*(1/winlen);
標簽: 短時過零率和短時能量
上傳時間: 2019-09-23
上傳用戶:minwenji
讀入輸入的n的大小,n個字符串,和權值建立哈弗曼樹,并進行哈夫曼編碼
標簽: C語言哈弗曼樹
上傳時間: 2019-11-16
上傳用戶:zlmzlm
#include <stdio.h> #include <stdlib.h> #define SMAX 100 typedef struct SPNode { int i,j,v; }SPNode; struct sparmatrix { int rows,cols,terms; SPNode data [SMAX]; }; sparmatrix CreateSparmatrix() { sparmatrix A; printf("\n\t\t請輸入稀疏矩陣的行數,列數和非零元素個數(用逗號隔開):"); scanf("%d,%d,%d",&A.cols,&A.terms); for(int n=0;n<=A.terms-1;n++) { printf("\n\t\t輸入非零元素值(格式:行號,列號,值):"); scanf("%d,%d,%d",&A.data[n].i,&A.data[n].j,&A.data[n].v); } return A; } void ShowSparmatrix(sparmatrix A) { int k; printf("\n\t\t"); for(int x=0;x<=A.rows-1;x++) { for(int y=0;y<=A.cols-1;y++) { k=0; for(int n=0;n<=A.terms-1;n++) { if((A.data[n].i-1==x)&&(A.data[n].j-1==y)) { printf("%8d",A.data[n].v); k=1; } } if(k==0) printf("%8d",k); } printf("\n\t\t"); } } void sumsparmatrix(sparmatrix A) { SPNode *p; p=(SPNode*)malloc(sizeof(SPNode)); p->v=0; int k; k=0; printf("\n\t\t"); for(int x=0;x<=A.rows-1;x++) { for(int y=0;y<=A.cols-1;y++) { for(int n=0;n<=A.terms;n++) { if((A.data[n].i==x)&&(A.data[n].j==y)&&(x==y)) { p->v=p->v+A.data[n].v; k=1; } } } printf("\n\t\t"); } if(k==1) printf("\n\t\t對角線元素的和::%d\n",p->v); else printf("\n\t\t對角線元素的和為::0"); } int main() { int ch=1,choice; struct sparmatrix A; A.terms=0; while(ch) { printf("\n"); printf("\n\t\t 稀疏矩陣的三元組系統 "); printf("\n\t\t*********************************"); printf("\n\t\t 1------------創建 "); printf("\n\t\t 2------------顯示 "); printf("\n\t\t 3------------求對角線元素和"); printf("\n\t\t 4------------返回 "); printf("\n\t\t*********************************"); printf("\n\t\t請選擇菜單號(0-3):"); scanf("%d",&choice); switch(choice) { case 1: A=CreateSparmatrix(); break; case 2: ShowSparmatrix(A); break; case 3: SumSparmatrix(A); break; default: system("cls"); printf("\n\t\t輸入錯誤!請重新輸入!\n"); break; } if (choice==1||choice==2||choice==3) { printf("\n\t\t"); system("pause"); system("cls"); } else system("cls"); } }
上傳時間: 2020-06-11
上傳用戶:ccccy
ZLG-imx6ul核心板開發板底板Altium Designer AD設計硬件原理圖文件,IoTIoT -6G 2C 6G2C -L采用 無線 核心板 核心板 和底板 組合的方式,核心和底板 組合的方式,核心和底板 組合的方式,核心和底板 組合的方式,核心和底板 組合的方式,核心和底板 組合的方式,核心采用 NXPNXPNXP基于 ARM CortexARM CortexARM Cortex ARM CortexARM Cortex ARM CortexARM Cortex -A7內核的 內核的 i.MXi.MX i.MX6UL6UL6UL應用處理器, 應用處理器, 應用處理器, 主頻最高達 主頻最高達 主頻最高達 528 MH z,核心板 核心板 配備 256256 MB MB MB DDR 3和 256 MB NAND FlashNAND FlashNAND FlashNAND FlashNAND FlashNAND FlashNAND FlashNAND Flash NAND Flash;此外核心板 此外核心板 還支 持支持 802.11b/g/n802.11b/g/n 802.11b/g/n 802.11b/g/n 802.11b/g/n協議 WIFIWIFIWIFIWIFI、藍牙 4.0 通信功能 。主板 提供 8路 UARTUARTUARTUART、1路模擬 I2C、1路 12bit ADC 12bit ADC12bit ADC12bit ADC12bit ADC12bit ADC,支持兩通道采樣 ,支持兩通道采樣 ,支持兩通道采樣 ,支持兩通道采樣 ,支持兩通道采樣 、2路 10/100M 10/100M 10/100M以太網接口、 以太網接口、 以太網接口、 以太網接口、 1路 SD 卡電路 卡電路 、1路左右聲道 左右聲道 左右聲道 模擬音頻 模擬音頻 接口、 接口、 2路 USB HostUSB HostUSB HostUSB HostUSB HostUSB Host 接口 (1路與 USB DeviceUSB Device USB DeviceUSB DeviceUSB DeviceUSB DeviceUSB DeviceUSB Device 共用同一路 共用同一路 USB OTGUSB OTGUSB OTGUSB OTGUSB OTGUSB OTGUSB OTG)、 1路 USB USB USB USB DeviceDevice DeviceDevice 接口, 接口, 可滿足數據采集等多種 滿足數據采集等多種 滿足數據采集等多種 滿足數據采集等多種 消費電子和工業控制應用 消費電子和工業控制應用 消費電子和工業控制應用 消費電子和工業控制應用 消費電子和工業控制應用 場合 。
標簽: zlg 文件 核心 開發板 底板 altium designer ad 設計 硬件 原理圖 imx6ul
上傳時間: 2022-05-11
上傳用戶:fliang
艾默生 模塊電源的并聯均流技術:n一,概述 n二,常用并聯均流技術 n三,應用實例 n四,注意事項
上傳時間: 2022-07-26
上傳用戶:
任何雷達接收器所接收到的回波(echo)訊號,都會包含目標回波和背景雜波。雷達系統的縱向解析度和橫向解析度必須夠高,才能在充滿背景雜波的環境中偵測到目標。傳統上都會使用短週期脈衝波和寬頻FM 脈衝來達到上述目的。
上傳時間: 2014-12-23
上傳用戶:zhqzal1014
第一章 序論……………………………………………………………6 1- 1 研究動機…………………………………………………………..7 1- 2 專題目標…………………………………………………………..8 1- 3 工作流程…………………………………………………………..9 1- 4 開發環境與設備…………………………………………………10 第二章 德州儀器OMAP 開發套件…………………………………10 2- 1 OMAP介紹………………………………………………………10 2-1.1 OMAP是什麼?…….………………………………….…10 2-1.2 DSP的優點……………………………………………....11 2- 2 OMAP Architecture介紹………………………………………...12 2-2-1 OMAP1510 硬體架構………………………………….…12 2-2.2 OMAP1510軟體架構……………………………………...12 2-2.3 DSP / BIOS Bridge簡述…………………………………...13 2- 3 TI Innovator套件 -- OMAP1510 ……………………………..14 2-2.1 General Purpose processor -- ARM925T………………...14 2-2.2 DSP processor -- TMS320C55x …………………………15 2-2.3 IDE Tool – CCS …………………………………………15 2-2.4 Peripheral ………………………………………………..16 第三章 在OMAP1510上建構Embedded Linux System…………….17 3- 1 嵌入式工具………………………………………………………17 3-1.1 嵌入式程式開發與一般程式開發之不同………….….17 3-1.2 Cross Compiling的GNU工具程式……………………18 3-1.3 建立ARM-Linux Cross-Compiling 工具程式………...19 3-1.4 Serial Communication Program………………………...20 3- 2 Porting kernel………………………………………………….…21 3-2.1 Setup CCS ………………………………………….…..21 3-2.2 編譯及上傳Loader…………………………………..…23 3-2.3 編譯及上傳Kernel…………………………………..…24 3- 3 建構Root File System………………………………………..…..26 3-3.1 Flash ROM……………………………………………...26 3-3.2 NFS mounting…………………………………………..27 3-3.3 支援NFS Mounting 的kernel…………………………..27 3-3.4 提供NFS Mounting Service……………………………29 3-3.5 DHCP Server……………………………………………31 3-3.6 Linux root 檔案系統……………………………….…..32 3- 4 啟動及測試Innovator音效裝置…………………………..…….33 3- 5 建構支援DSP processor的環境…………………………...……34 3-5.1 Solution -- DSP Gateway簡介……………………..…34 3-5.2 DSP Gateway運作架構…………………………..…..35 3- 6 架設DSP Gateway………………………………………….…36 3-6.1 重編kernel……………………………………………...36 3-6.2 DEVFS driver…………………………………….……..36 3-6.3 編譯DSP tool和API……………………………..…….37 3-6.4 測試……………………………………………….…….37 第四章 MP3 Player……………………………………………….…..38 4- 1 MP3 介紹………………………………………………….…….38 4- 2 MP3 壓縮原理……………………………………………….….39 4- 3 Linux MP3 player – splay………………………………….…….41 4.3-1 splay介紹…………………………………………….…..41 4.3-2 splay 編譯………………………………………….…….41 4.3-3 splay 的使用說明………………………………….……41 第五章 程式改寫………………………………………………...…...42 5-1 程式評估與改寫………………………………………………...…42 5-1.1 Inter-Processor Communication Scheme…………….....42 5-1.2 ARM part programming……………………………..…42 5-1.3 DSP part programming………………………………....42 5-2 程式碼………………………………………………………..……43 5-3 雙處理器程式開發注意事項…………………………………...…47 第六章 效能評估與討論……………………………………………48 6-1 速度……………………………………………………………...48 6-2 CPU負載………………………………………………………..49 6-3 討論……………………………………………………………...49 6-3.1分工處理的經濟效益………………………………...49 6-3.2音質v.s 浮點與定點運算………………………..…..49 6-3.3 DSP Gateway架構的限制………………………….…50 6-3.4減少IO溝通……………….………………………….50 6-3.5網路掛載File System的Delay…………………..……51 第七章 結論心得…
上傳時間: 2013-10-14
上傳用戶:a471778