[筆記]linked list

Contiguous list: List stored in a homogeneous
array

Linked list: List in which each entries are
linked by pointers
– Head pointer: Pointer to first entry in list
– NIL pointer: A “non-pointer” value used to
indicate end of list

linked list他還有一個指標跟在後面 而且指標指到下一位linked list

linked list 最前面有個head poiter  在前頭的指標 用來只向第一個linked list 的資料

NIL pointer :在linked list 的最後一個linked list 因為已經是最後一個了 所以最後一個linked list 的指標因此不用指向下一個(因為他自己本身就是最後一個) 所以就稱NIL pointer

 Linked list 還有兩部份 一個是data 一個是link 也就是指向下個的指標

 

The elements in a linked list are traditionally called nodes

When you want to insert into a linked list, you must consider
four cases: adding to the empty list, adding at the beginning,
adding to the middle, and adding at the end.

當你要去增加一個linked list 你會要思考四種情況 1.加入到一個空的list 2.加入到list 的開頭3.加入到list 的中間4.加入到list的末端