Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
リンクリストでの検索の複雑さはO(n)です。
キューまたはスタックで検索する場合もO(n)ですよね?
順序付けされていない場合はそうO(n)です。最悪の場合、すべての要素を調べる必要があるためです。
O(n)
ではない正確に。
それはあなたの実装に依存します。たとえば、キュー/スタック内にハッシュテーブルがある場合、O(1)プッシュ/ポップ/検索で「スーパー」キュー/スタックを取得します。