Ex4-22 單射函數問題 « 問題描述: 設函數f將點集S = {0,1, , n -1}映射為f (S) = { f (i) | iÎ S} Í S 。單射函數問題要 從S中選取最大子集X Í S 使f (X )是單射函數。 例如,當n=7, f (S) = {1,0,0,2,2,3,6} Í S 時, X = {0,1,6} Í S 是所求的最大子集。 « 編程任務: 對于給定的點集S = {0,1, , n -1}上函數f,試用抽象數據類型隊列,設計一個O(n)時 間算法,計算f的最大單射子集。 « 數據輸入: 由文件input.txt 提供輸入數據。文件的第1 行有1 個正整數n,表示給定的點集 S = {0,1, , n -1}。第2 行是f (i)的值,0 £ i < n。 « 結果輸出: 程序運行結束時,將計算出的f的最大單射子集的大小輸出到output.txt中。 輸入文件示例 輸出文件示例 input.txt 7 1 0 0 2 2 3 6 output.txt 3
上傳時間: 2016-05-28
上傳用戶:tyler
% EM algorithm for k multidimensional Gaussian mixture estimation % % Inputs: % X(n,d) - input data, n=number of observations, d=dimension of variable % k - maximum number of Gaussian components allowed % ltol - percentage of the log likelihood difference between 2 iterations ([] for none) % maxiter - maximum number of iteration allowed ([] for none) % pflag - 1 for plotting GM for 1D or 2D cases only, 0 otherwise ([] for none) % Init - structure of initial W, M, V: Init.W, Init.M, Init.V ([] for none) % % Ouputs: % W(1,k) - estimated weights of GM % M(d,k) - estimated mean vectors of GM % V(d,d,k) - estimated covariance matrices of GM % L - log likelihood of estimates %
標簽: multidimensional estimation algorithm Gaussian
上傳時間: 2013-12-03
上傳用戶:我們的船長
Tasks Read the textbook about the details of Vigenére Cipher. Implement the algorithm by C or C++. Requirements You do this lab in a group of two students. Your program should have input and output as follows: csci>a.out --> Please input the key: receptive --> Please input the plain text: wearediscoveredsaveyourself --> The cipher text is : nicvtwqngfzgvtwavzvcqyglmgj -->The original message is: wearediscoveredsaveyourself • You should test your program with several runs.
標簽: the Implement algorithm textbook
上傳時間: 2013-12-21
上傳用戶:bruce5996
% decode with soft-input viterbi algorithm 硬判決 % //k=4,r=1/2 %輸入數據為軟信息,并且數據為均值為1的BPSK調制,如果均值為MEAN,那么62,63,103,104行應做相應修改
標簽: soft-input algorithm viterbi decode
上傳時間: 2014-10-28
上傳用戶:aig85
This example code takes and averages 2048 analog measurements from input P1.4 using ADC0, then prints the results to a terminal window via the UART.
標簽: measurements averages example analog
上傳時間: 2016-06-13
上傳用戶:xuan‘nian
sorting input lines developed by C++ in linux environment
標簽: environment developed sorting input
上傳時間: 2013-11-28
上傳用戶:lgnf
Description 為了宣傳本次“網宿科技杯”廈門大學第五屆程序設計競賽,系里面做了兩張精美的海報。經過了精確的計算,為了達到最佳美觀效果,每張海報都有自己最佳的粘貼位置。但是現在問題是,如果兩張海報都要求貼在最佳位置時,很有可能有部分地方會重疊在一起?,F在您來判斷一下這兩張海報是否重疊。 Input 輸入包含兩行,每一行有四個整數來描述這個海報的最佳粘貼位置,X,Y,W,H(-10000<= X,Y <= 10000)(0 < W, H <= 10000),X,Y表示海報左下角的坐標,W,H分別表示寬度和高度。 Output 輸出"Yes"表示兩張海報互相重疊(表示存在一個面積大于0的公共區域),否則輸出"No"。(不包含引號,注意大小寫) Sample Input -10 -10 20 30 0 0 30 20 Sample Output Yes
標簽: Description 大學 程序設計 競賽
上傳時間: 2016-06-26
上傳用戶:gxf2016
The goal of our final project was to design an efficient elevator simulator that can accept input from a user and mechanically operate (on a small scale) a system of 4 floors and 3 elevators using pulleys and stepper motors. Users enter input using physical pushbuttons or the computer. This input is then processed by the MCU and orders are given to the elevators. We attempted to devise an algorithm that can optimally handle any number of floors. This project seemed like a fun challenge and something that had practical applications. Both of us have been frustrated at times by the inefficiency of some of the elevators here at Cornell, and we wanted to see if we could do a better job.
標簽: efficient simulator elevator project
上傳時間: 2013-11-25
上傳用戶:cjf0304
huffman decode all you need is input a data so that it will decode
上傳時間: 2016-07-05
上傳用戶:AbuGe
包含拼音和筆畫輸入的中文輸入法,使用VC.NET2003開發.portable Chinese input method includes phonetic input and stroke, the use of VC.NET2003 development, WINCE.NET also can be used to understand the system and the family system!
標簽: input portable includes phonetic
上傳時間: 2013-12-30
上傳用戶:15071087253