From week 8 to 10 I learnt about a binary tree, a linked list and a
binary search tree.
A linked list is a linear data structure containing elements. Each element
contains a data and a reference to the next node. The first node in the linked
list refers as head, and the last node points null. The advantage of a linked
list is that the number of nodes in the list is not fixed, and can add or
delete the node. However, it cannot directly access to the individual elements.
To find a particular element, need to go through from the head and the reference
until it reaches the element.
The binary tree is made up by nodes, where each node contains element,
left and right references (or subtree). This tree has many terms. First, the
node at the top is called root. Parent is a node directly connected from one
other node. Children are an arbitrary number of nodes connected branched off
from parent. The number of children has to be either 1 or 2. If a node does not
have children, it is called leaves. It represents data in hierarchical form,
and does not allow duplicate values, so it will be easier to find a certain element
in tree structure.
The binary search tree is similar as the binary tree except a left
sub-tree contains a number less than a root while a right sub-tree contains a
number bigger than the root. Both sub-trees also have to a binary search tree. As
similar as the binary tree, it is easier to find an element since elements in
left sub-tree are smaller than an element in root while the right sub-tree
contains bigger elements. It is also efficient on memory space, because it does
not reserve more memory than it needs to. It can act as a list, so it can split,
remove or insert an element faster.
In general, I think the computer science topics are hard for me to understand and apply knowledge to write a code. Most of time, I need to practice and go over what I did or learnt in labs or class to fully understand. I looked up the idea and practiced, so I think I can do it now, but I think I need more practices.
In general, I think the computer science topics are hard for me to understand and apply knowledge to write a code. Most of time, I need to practice and go over what I did or learnt in labs or class to fully understand. I looked up the idea and practiced, so I think I can do it now, but I think I need more practices.
댓글 없음:
댓글 쓰기