在做projectEuler 23題的時候需要時候排列組合的知識。原文連結:MSDN雜誌 《使用 F# 的排列與組合》 let temp = [| for i in 0..k-1 -> data.[i] |] // find "x" - right-most index to change let mutable x = k-1 while x > 0 && temp.[x] = n - k + x do x <- x - 1 temp.
Q:請給出一個已耗用時間為θ(nlgn)的演算法,使之能在一個由n個整數構成的集合S和另一個整數X時,判斷出S中是否存在有兩個其和等於X的元素。A:先對S[1 TO N]進行合并排序--------------------------------θ(nlgn)FOR a <- [1 TO N-1]-------------------------------------n-1 用二分法試圖找到b(最壞情況時),使得b+a==x---------θ(nlgn)所以:
Here are some common causes of redesign along with the design pattern(s) that address them:Creating an object by specifying a class explicitly.通過顯示方式指定一個類來建立對象在建立對象時指定類名將使你受特定實現的約束,而不是特定介面的約束。Abstract Factory(87) ,Factory
ight:500px;width:100%;">;cubeRoot函數只適用於x是正數時,負數時是在m函數中處理的。(define (cubeRoot x guess) ;x除以兩次guess,得到result,(要是result等於guess,那麼這個guess就是最結果了) (define result (/ x guess guess ) )
Table 6.1. Selected Numeric TypesTypeDescriptionDoubleDouble-precision floating point. A common choice for floating-point data.FloatSingle-precision floating point. Often used when interfacing with C.IntFixed-precision signed integer; minimum range [
cart 手推車,運貨馬車 a shopping cart. He drives a cart.endian 段模式 little endian intel相容機器 big endian ibm,motorola,sun microsystems的大多數機器(有些相容的)cast 轉換 featured cast [影]主要演員陣容 cast steel 鑄鐵 cast seed 播種 cast a plan
What is a type ?a type is a name for a colletion of related values.for example , in haskell the basic type Boolcontains the two logical values:False True----all type errors are found at compile time , which makes programs safer and faster by
好久沒寫博咯,因為學校的項目asp.net開發一個SCM,這學期才開始學做網站,需要大量時間打基礎,再次感到,台上一分鐘台下十年功。 言歸正傳,.NET4.0出來有些日子了,自己LINQ卻還未接觸,之前都認為不過是文法糖啦,學不學無所為啦,上次看了aders hejlsberg 在.NET4.0發布會上的視頻,more about what,less about