資料結構›Ch3 堆疊與佇列
第 3 題/共 28 題
◀ DS 3/28
3. Stack、演算法設計
#DS-03-003中Stack演算法設計

Let SS be a stack containing n+1n+1 coefficients a0,a1,…,ana_0, a_1, \dots, a_n, where n≥1n \ge 1, ana_n is at the top of the stack, and a0a_0 is at the bottom. The following algorithm computes f(x)=∑i=0naixif(x) = \sum_{i=0}^{n} a_i x^i. Identify the missing expression □\square in the pseudocode.

POLY(S, x) 1 while S.size >= 2 2 u = S.pop() 3 v = S.pop() 4 S.push(□) 5 return S.pop()

📄 台大115
跳轉到第題
▤完整推導請見《WH 資工筆記 · 資料結構》Ch3 堆疊與佇列
本章題號 · 1–20 / 28