In this week's lecture we continued to explore about
LinkedList from last week. The concept of LinkedList initially has given me
quite a hard time to understand. After I spend an hour on reading the class
LinkedList after Monday’s lecture, now I understand the structure of a
LinkedList. So, What is a LinkedList? It is very similar to a nested list. For
example, a LinkedList should have this kind of structure
LinkedList(0,LinkedList(1,LinkedList( ))), and think each LinkedList to be a
node: a node is where some cargo or value is stored. By looking at this
example, it is clear that a LinkedList is constructed with a series of linked
nodes. Furthermore, in the example, the leftmost LinkedList(0, contains some
value 0, we refer this portion to be the head, and LinkedList(1,LinkedList( )))
refers to the rest.
A picture to illustrate a LinkedList.
The methods of a LinkedList involves the operation of adding
value which means more LinkedList nodes, and this method method is called
“prepend.” another mothod is called “decapitate” witch deletes the head (the
leftmost LinkedList) and make the leftmost of a rest to become a head. Few
other methods are: insert(insert a LinkedList node into an existed LinkedList,
delete(delete a LinkedList node from an existed LinkedList) and reverse(reverse
a existed LinkedList).
This week we also learned about binary search, which is a
searching algorithm. To put it simple, this type of search starts at the middle
node of the LinkedList, and creates an upper-set (goes towards the end) and a
lower-set (goes towards the front) of nodes. during the search, each LinkedList
node is checked above and below until the value is found.
Thank you for reading my blog.
No comments:
Post a Comment