mirror of
https://github.com/krahets/hello-algo.git
synced 2025-11-06 23:26:36 +08:00
Bug fixes and improvements (#1813)
* Sync zh and zh-hant version. * Add the Warp sponsor banner. * Update README with acknowledgments and Warp recommendation Added acknowledgments and a recommendation for the Warp terminal application. * Update README.md * Update links in README.md to use HTTPS * Sync zh and zh-hant versions. * Add special thanks for Warp spnsorship. * Use official warp image link.
This commit is contained in:
@ -47,3 +47,9 @@
|
||||
假設取 $n = 8$ ,你可能會發現每條曲線的值與函式對應不上。這是因為每條曲線都包含一個常數項,用於將取值範圍壓縮到一個視覺舒適的範圍內。
|
||||
|
||||
在實際中,因為我們通常不知道每個方法的“常數項”複雜度是多少,所以一般無法僅憑複雜度來選擇 $n = 8$ 之下的最優解法。但對於 $n = 8^5$ 就很好選了,這時增長趨勢已經佔主導了。
|
||||
|
||||
**Q** 是否存在根據實際使用場景,選擇犧牲時間(或空間)來設計演算法的情況?
|
||||
|
||||
在實際應用中,大部分情況會選擇犧牲空間換時間。例如資料庫索引,我們通常選擇建立 B+ 樹或雜湊索引,佔用大量記憶體空間,以換取 $O(\log n)$ 甚至 $O(1)$ 的高效查詢。
|
||||
|
||||
在空間資源寶貴的場景,也會選擇犧牲時間換空間。例如在嵌入式開發中,裝置記憶體很寶貴,工程師可能會放棄使用雜湊表,選擇使用陣列順序查詢,以節省記憶體佔用,代價是查詢變慢。
|
||||
|
||||
Reference in New Issue
Block a user