關於 HW#4 singly-linked list, doubly-linked list, and dynamic array
member functions 的定義, 除了題目的定義之外, 請大家參照 STL 的定義.
比方說, 有同學在問 dynamic array 的 insert and erase 是否可如上課所說的,
將被 delete 的 element 調到最後面去, 以達到 const time complexity 的目的?
答案是"不行"
根據 STL 的說明, 在 erase and insert 之後, 其它 elements 的相對順序
應該維持不變, 所以, 必須為 linear time complexity.
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 59.121.135.53