Linked List - Why you could be so long?
- Linked List Node
- Linked List
efforts in it. Confronting with tons of different bugs keeping optimizing the
construction. Although it made me wore out, but I find that my significant
progress in competence of debugging and the understanding of recursion.
Here comes to the point. This week ,I learned LLNode and LinkedList. To be
honest, at first I did not understanding what they are. But then, after
finishing the practice of lab handout, I find its amazing features.
At first, LLNode is the composition of a LinkedList. It is a ADT that
contains a value and a successor variable which could be used to point at
another LLNode. Because of the existence of this variable we could link tons
of LLNode together.
contains a value and a successor variable which could be used to point at
another LLNode. Because of the existence of this variable we could link tons
of LLNode together.
Hence, another class called LinkedList is invented to construct these LLNodes
together with specify its heading(front) and tail(back). Just like a snake
game, which could keep elongating without limits, which is even more special
that it could add elements from the front.
By the way, with creating many methods, we could use it to implement some
functions like indexing, append, insert and delete...
There is a very tricky place when we want to insert a LLNode in the LinkedList.
Here is a case that I want to insert a LLNode(2) into the LinkedList that LLNode(1).nxt = LLNode(3)
Firstly I have to change the LLNode(2).nxt = LLNode(3), then I change the
LLNode(1).nxt = LLNode(2).The key here is that, if you change the LLNode(1).nxt =
LLNode(2) first, we will lose the ability to find LLNode(3). Hence, we should
use LLNode(2) to aim at LLNode(3) at first then change the LLNode(1).
I believe, LinkedList must have many other interesting and amazing latent energy.
More practice, more you will learn.


没有评论:
发表评论