前端清空 List 導致五十億元素位移
I Drained a List From the Front. It Shifted Five Billion Elements.
重點導讀
導語: List.RemoveAt(0) 會在每次移除時將剩餘元素全部向前滑動,導致 O(n²) 的時間複雜度。
- 位移量:對 100,000 個元素,總共移動約 5,000,000,000 次。
AI 伴隨問答
針對這篇報導有疑問?可直接點選快捷問題或向 AI 追問背景脈絡與技術細節:
信源出處dev.to
I Drained a List From the Front. It Shifted Five Billion Elements.
本文為 888news 精選之重點導讀。若需閱讀作者完整原文、技術細節與官方討論,請前往原始網站。
來源: Dev.to Top Tech (dev.to)
開啟原文