LoginSignup
0
0

More than 3 years have passed since last update.

linked list

Posted at

linked listは、access timeはO(n)でよくないが、
insertion timeがO(1)で優れている。

linked listのnodeには、データと次のリンクを指すnextが格納されている。nextにはnullが格納されている。

Node1.data = "G"
Node1.next = Node2
Node2.data = "R"
Node2.next = Node3
Node3.data = "O"
Node3.next = Node4
Node4.data = "W"
Node4.next = null
#Node1.next.nextは、Node3を意味する。

また、bi-directionalと呼ばれる双方型のlinked listも存在する。

Node2.data = "5"
Node1.next = Node2
Node2.previous = Node1
#1から2と、2から1の両方が定義されている。
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0