-
We have a group of N items (represented by integers from 1 to N), and we know that there is some total order defined for these items. You may assume that no two elements will be equal (for all a, b: a<b or b<a). However, it is expensive to compare two items. Your task is to make a number of comparisons, and then output the sorted order. The cost of determining if a < b is given by the bth integer of element a of costs (space delimited), which is the same as the ath integer of element b. Naturally, you will be judged on the total cost of the comparisons you make before outputting the sorted order. If your order is incorrect, you will receive a 0. Otherwise, your score will be opt/cost, where opt is the best cost anyone has achieved and cost is the total cost of the comparisons you make (so your score for a test case will be between 0 and 1). Your score for the problem will simply be the sum of your scores for the individual test cases.
標(biāo)簽:
represented
integers
group
items
上傳時間:
2016-01-17
上傳用戶:jeffery
-
單純形法算法,int K,M,N,Q=100,Type,Get,Let,Et,Code[50],XB[50],IA,IAA[50],Indexg,Indexl,Indexe
float Sum,A[50][50],B[50],C[50]
標(biāo)簽:
50
Indexg
Indexe
Indexl
上傳時間:
2013-12-22
上傳用戶:頂?shù)弥?/p>
-
Floyd-Warshall算法描述
1)適用范圍:
a)APSP(All Pairs Shortest Paths)
b)稠密圖效果最佳
c)邊權(quán)可正可負
2)算法描述:
a)初始化:dis[u,v]=w[u,v]
b)For k:=1 to n
For i:=1 to n
For j:=1 to n
If dis[i,j]>dis[i,k]+dis[k,j] Then
Dis[I,j]:=dis[I,k]+dis[k,j]
c)算法結(jié)束:dis即為所有點對的最短路徑矩陣
3)算法小結(jié):此算法簡單有效,由于三重循環(huán)結(jié)構(gòu)緊湊,對于稠密圖,效率要高于執(zhí)行|V|次Dijkstra算法。時間復(fù)雜度O(n^3)。
考慮下列變形:如(I,j)∈E則dis[I,j]初始為1,else初始為0,這樣的Floyd算法最后的最短路徑矩陣即成為一個判斷I,j是否有通路的矩陣。更簡單的,我們可以把dis設(shè)成boolean類型,則每次可以用“dis[I,j]:=dis[I,j]or(dis[I,k]and dis[k,j])”來代替算法描述中的藍色部分,可以更直觀地得到I,j的連通情況。
標(biāo)簽:
Floyd-Warshall
Shortest
Pairs
Paths
上傳時間:
2013-12-01
上傳用戶:dyctj
-
編寫一個用SOR法解方程組Ax=b的計算機程序,其中
要求程序中不存系數(shù)A,分別對不同的階數(shù)(例如n=15,80)取w=1.7,1.8,1.9,進行迭代,記錄近似解 達到 時所用迭代次數(shù)k,觀察松弛因子對收斂速度的影響。
標(biāo)簽:
SOR
Ax
編寫
方程
上傳時間:
2013-12-25
上傳用戶:wcl168881111111
-
數(shù)據(jù)結(jié)構(gòu)
1、算法思路:
哈夫曼樹算法:a)根據(jù)給定的n個權(quán)值{W1,W2… ,Wn }構(gòu)成 n棵二叉樹的集合F={T1,T2…,T n },其中每棵二叉樹T中只有一個帶權(quán)為W i的根結(jié)點,其左右子樹均空;b)在F中選取兩棵根結(jié)點的權(quán)值最小的樹作為左右子樹構(gòu)造一棵新的二叉樹,且置新的二叉樹的根結(jié)點的權(quán)值為其左、右子樹上結(jié)點的權(quán)值之和;c)F中刪除這兩棵樹,同時將新得到的二叉樹加入F中; d)重復(fù)b)和c),直到F只含一棵樹為止。
標(biāo)簽:
算法
W1
數(shù)據(jù)結(jié)構(gòu)
樹
上傳時間:
2016-03-05
上傳用戶:lacsx
-
A* sudo sudo/*
B* adduser script adduser
C* rmuser script rmuser
E* tout tout/*
F* dumdum dumdum
G* lostfile lostfile
H* Mkfl.localsys Makefile.localsys
I* spacegripe spacegripe
J* sendmail.cf sendmail.cf
N* remote remote.c
O* distributed conrol distrib/*
P* hosts and name server makerevhosts
Q* xargs xargs/*
標(biāo)簽:
adduser
script
rmuser
sudo
上傳時間:
2016-03-29
上傳用戶:gxrui1991
-
某旅館有n個等級的房間,第i等級有a個房間,每個等級有b個床位(1<=i<=n).
模擬旅館個管理系統(tǒng)中床位的分配和回收功能,設(shè)計能為單個旅客分配床位,在其離店便回收床位(供下次分配)的算法
標(biāo)簽:
房間
上傳時間:
2016-04-14
上傳用戶:VRMMO
-
%radon transform
clear all
%
N=800
n=1:N
fs=200
t=n/fs
x1=exp(j*2*pi*(5*t+0.5*5*t.^2))
x2=exp(j*2*pi*(5*t+0.5*15*t.^2))
x=x1+x2
%N=length(x)
% ambifunb(x )
%*****************************************RAT
naf=ambifunb(x)
htl(abs(naf))
% [wh,rho,theta]=htl(abs(naf))
colormap([0,0,0])
% xlabel( 極半徑 )
% ylabel( 角度 )
%**************************************%找出峰值點的坐標(biāo),計算初始頻率和調(diào)頻斜率(正確)
%找出峰值點的坐標(biāo)
b=max(max(wh))
[u,a]=find(wh>=0.8*b)
標(biāo)簽:
transform
radon
clear
fs
上傳時間:
2014-10-27
上傳用戶:Yukiseop
-
給定n個矩陣{A1,A2,…,An},其中Ai與Ai+1是可乘的,i=1,2,…,n-1。考察這n個矩陣的連乘積A1A2…An。由于矩陣乘法滿足結(jié)合律,故計算矩陣的連乘積可以有許多不同的計算次序,這種計算次序可以用加括號的方式來確定。若一個矩陣連乘積的計算次序完全確定,則可以依此次序反復(fù)調(diào)用2個矩陣相乘的標(biāo)準(zhǔn)算法(有改進的方法,這里不考慮)計算出矩陣連乘積。若A是一個p×q矩陣,B是一個q×r矩陣,則計算其乘積C=AB的標(biāo)準(zhǔn)算法中,需要進行pqr次數(shù)乘。
標(biāo)簽:
An
矩陣
上傳時間:
2016-06-18
上傳用戶:hjshhyy
-
用過采樣和求均值提高ADC分辨率
很多應(yīng)用需要使用模/數(shù)轉(zhuǎn)換器 ADC 進行測量 這些應(yīng)用所需要的分辨率取決于信號的動
態(tài)范圍 必須測量的參數(shù)的最小變化和信噪比 SNR 因此 很多系統(tǒng)使用較高分辨率的片外ADC
然而也可以通過使用一些技術(shù)來達到較高的分辨率和SNR 本應(yīng)用筆記介紹用過采樣和求均值的方
法來提高模數(shù)轉(zhuǎn)換的分辨率和SNR 過采樣和求均值技術(shù)可以在不使用昂貴的片外ADC的情況下提
高測量分辨率
本應(yīng)用筆記討論如何使用過采樣和求均值的方法來提高模/數(shù)轉(zhuǎn)換 ADC 測量的分辨率 另
外 本文最后的附錄A B和C分別給出了對ADC噪聲的深入分析 最適合過采樣技術(shù)的ADC噪聲
類型和使用過采樣和求均值技術(shù)的示例代碼
標(biāo)簽:
ADC
SNR
分辨率
測量
上傳時間:
2016-06-21
上傳用戶:hanli8870