本文へスキップ

リソース · ガイド・記事

Linked List

単方向連結リストの基本を扱います。配列とのトレードオフ(アクセスが線形時間、キャッシュの局所性が弱い)を含め、面接でよく問われる操作の疑似コードを載せています。

確認日

元のサイトを開く: Linked List (元のサイトを新しいタブで開きます)

このトピックを練習技術 / コーディング モードで練習用面接官を開きます。問題はそこで選びます。

ロードマップに追加

取り組んでいるロードマップにこのリソースを追加できます。自分用の追加リソースとして表示され、ロードマップの手順は変わらず、記録した手順数にも数えられません。

出典コンテンツの言語:英語

Read this in other languages: 简体中文, Русский, 日本語, Português, 한국어, Español, Türkçe, Українська In computer science, a linked list is a linear collection of data elements, in which linear order is not given by their physical placement in memory. Instead, each element points to the next. It is a data structure consisting of a group of nodes which together represent a sequence. Under the simplest form, each node is composed of data and a reference (in other words, a link) to the next node in the sequence. This structure allows for efficient insertion or removal of elements from any position in the sequence during iteration. More complex variants add additional links, allowing efficient insertion or removal from arbitrary element references. A drawback of linked lists is that access time is linear (and difficult to pipeline). Faster access, such as random access, is not feasible. Arrays have better cache locality as compared to linked lists.

PrepKit の概要

この概要は PrepKit 編集部がソースリポジトリをもとに執筆・確認したもので、リソース本文の引用ではありません。

対象
ソースにレベルの記載はありません
形式
リファレンス

扱っている内容

  • 先頭と末尾のポインタを保ちながら末尾に追加する Add と先頭に追加する Prepend の疑似コード
  • Contains による探索と値による Remove で、末尾の更新も含みます
  • 前方向の走査と、各ノードの直前のノードを先頭から探す2乗時間の逆方向の走査
  • 計算量の表:アクセスと探索 O(n)、挿入 O(1)、削除 O(n)、空間 O(n)

使い方

PrepKit の学習アドバイスであり、ソースの主張ではありません。

すべての疑似コードを実装し、続いてページにはないインプレースでの反転を書いてください。長さ0、1、5のリストでテストします。

範囲と制約

循環の検出やインプレースでの反転といった定番の面接問題はなく、示されている逆方向の走査は入れ子のループを使う遅い版です。

利用方法と形式

GitHub の trekhleb/javascript-algorithms(MIT)にある README で、8つの翻訳へのリンクがあります。英語で、無料で読めます。

PrepKit が 2026/10/02 に確認しました。 リソースの出典のコミット: 85293e3e2b88

この概要の根拠
  • src/data-structures/linked-list/README.md

この項目を掲載しているページ

PrepKit ニュースレターを受け取る

任意です。PrepKit の利用には必要ありません。

メールアドレスの取り扱いについて