看板 Grad-ProbAsk 關於我們 聯絡資訊
1. For the following recursive procedure RP1, (a) find RP1 (2468) = ? (b)how many times for executing the instruction print (key mod 10) in (a) ? Procedure RP1 (key: integer) begin if key < 10 then print (key); else begin print (key mod 10); RP1 (key div 10) end end 2. Considering the following program, write its recursive program. long combi (int n, int r) { int i; long p = 1; for ( i = 1; i≦r; i++) p = p*(n – i + 1)/i; return (p) ; } 3. f(x) = 2x4 + 3x3 + 5x2 + 8x + 9, what is the least number of multiplications required for evaluating f(x) ? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 118.170.88.118