This section contains a brief introduction to the C language. It is intended as a tutorial on the language, and aims at getting a reader new to C started as quickly as possible. It is certainly not intended as a substitute for any of the numerous textbooks on C. 2. write a recursive function FIB (n) to find out the nth element in theFibanocci sequence number which is 1,1,2,3,5,8,13,21,34,55,…3. write the prefix and postfix form of the following infix expressiona + b – c / d + e * f – g * h / i ^ j4. write a function to count the number of nodes in a binary tr
C# BigInteger class. BigInteger.cs is a csharp program. It is the BIgInteger class. It has methods: abs() , FermatLittleTest(int confidence) ,gcd(BigInteger bi) , genCoPrime(int bits, Random rand) , genPseudoPrime(int bits, int confidence, Random rand) , genRandomBits(int bits, Random rand) , isProbablePrime(int confidence) , isProbablePrime() , Jacobi(BigInteger a, BigInteger b) , LucasSequence(BigInteger P, BigInteger Q, BigInteger k, BigInteger n) ,max(BigInteger bi) , min(BigInteger bi) , modInverse(BigInteger modulus) , RabinMillerTest(int confidence) ,
Verilog HDL: Magnitude
For a vector (a,b), the magnitude representation is the following:
A common approach to implementing these arithmetic functions is to use the Coordinate Rotation Digital Computer (CORDIC) algorithm. The CORDIC algorithm calculates the trigonometric functions of sine, cosine, magnitude, and phase using an iterative process. It is made up of a series of micro-rotations of the vector by a set of predetermined constants, which are powers of two. Using binary arithmetic, this algorithm essentially replaces multipliers with shift and add operations. In a Stratix™ device, it is possible to calculate some of these arithmetic functions directly, without having to implement the CORDIC algorithm.
本書提供用J B u i l d e r開發(fā)數(shù)據(jù)庫應(yīng)用程序、創(chuàng)建分布式應(yīng)用程序以及編寫J a v a B e a n
組件的高級資料。它包括下列幾個部分:
• 第一部分是“開發(fā)數(shù)據(jù)庫應(yīng)用程序”,它提供關(guān)于使用J b u i l d e r的D a t a E x p r e s s數(shù)據(jù)
庫體系結(jié)構(gòu)的信息,并解釋原始數(shù)據(jù)組件和類之間的相互關(guān)系,以及怎樣使用它
們來創(chuàng)建你的數(shù)據(jù)庫應(yīng)用程序。它還解釋怎樣使用Data Modeler(數(shù)據(jù)模型器)和
Application Generator(應(yīng)用程序生成器)創(chuàng)建數(shù)據(jù)驅(qū)動的客戶機(jī)/服務(wù)器應(yīng)用程
序。
• 第二部分是“開發(fā)分布式應(yīng)用程序”,它提供關(guān)于使用ORB Explorer、用J B u i l d e r
創(chuàng)建多級的分布應(yīng)用程序、調(diào)試分布式應(yīng)用程序、用J a v a定義C O R B A接口以及
使用s e r v l e t等的信息。
• 第三部分是“創(chuàng)建J a v a B e a n”,它解釋怎樣開發(fā)新的J a v a B e a n組件,描述在組件
開發(fā)中涉及的任務(wù), 怎樣使用B e a n s E x p r e s s創(chuàng)建新的J a v a B e a n,以及關(guān)于屬性、
事件、B e a nIn f o類和其他方面的詳細(xì)情況。
Floyd-Warshall算法描述
1)適用范圍:
a)APSP(All Pairs Shortest Paths)
b)稠密圖效果最佳
c)邊權(quán)可正可負(fù)
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即為所有點(diǎn)對的最短路徑矩陣
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])”來代替算法描述中的藍(lán)色部分,可以更直觀地得到I,j的連通情況。