Final Summary
Linked list is a process or a way that
enables us to easily edit an array without using looping (e.g for) to
count from zero to the point where we want to edit the data (also shifting is
needed when editing an array). So far, we have learned about two types of
linked list. Doubly and single linked list, the first one is the circular
single linked list. In circular single linked list, the last node contains a
pointer to the first node which can help determine whether the data is located
in the middle or in the end and also there is no storing of NULL value in the
list. Secondly there is double linked list, which is a two way linked list that
points to the nest data while also pointing to the previous data. Thirdly there
is circular doubly linked list which is very similar to the single linked list
but differ on the amount of pointer in each node (2). Just as I stated above,
linked list gives us the ability to edit an array far more efficient rather
than using a looping process. The reason to this is because there are processes
within the linked list that enables us to do so such as Inserting and deleting
certain values.
Stack is one of the basic flow of data
that can come from an array list or a linked list. Imagine if there was a stack
of boxes or plate. The last box or plate will be the first one to be used
(LiFo: Last in First out). Just like that analogy, the "Stack"
concept have only one place where the data can enter and exit which is the top.
We also learned about Infix, Prefix and Postfix which is the shifting of the
operators in a certain expression notation.
Hashing
Hashing is a technique used for
storing and retrieving keys in a rapid manner. The string of characters is made
shorter in length value but still represents its original string.
Hash Table
Hash table is a table of array
where a string is stored and can be hashed. Its size is usually smaller that
the total number of possible string, so several string might have a same
hashed-key.
Hash Function
There are a lot of ways to hash a
string into a key, the most common is Division.
Division
Division is one of the methods used
to hash a string into a key, which is done by dividing the string/identifier by
using the modulus operator and the value that is usually used is a prime
number, the table size or the size of memory used.
“HIKE” would be stored at the
location
(
64+8 + 64+9 + 64+11 + 64+5) % 97 = 2
Binary Tree
Binary tree is rooted tree data
structure in which each node has at most two children and the two children
usually distinguish themselves as left child and right child. The node that
doesn’t have any child is called leaf.
Types of binary tree
- Perfect
Binary Tree
It
is a binary tree which every level are at the same depth
- Complete
Binary Tree
It is a binary tree in which every
level except the last is completely filled and all nodes
are as far left as possible. A perfect binary tree is a complete binary tree
- Skewed
Binary Tree
It is a binary tree in which each
node has at most one child
- Balanced
Binary Tree
It is a binary tree in which no
leaf is much farther away from the root than any other leaf.
The Research
A hash is a function that converts
an input of letters and numbers into an encrypted output of a fixed length. A
hash is created using an algorithm and is essential
to blockchain management in cryptocurrency. It helps in storing data
of transaction (Time, Date, Who etc.). The blockchain technology is probably
one of the most defining technological innovations of our time. It has changed
the ways how digital transactions are managed and arranged. Hashing in
blockchain refers to the process of having an input of whatever length
reflecting an output item of a fixed length. Example : When you take video of
100 megabytes and hash it using SHA-256 the output will be a hash of 256-bits
in length and if you take a video of 50 megabytes the output will be the same.
The difference will lie on the hash pattern
Binary Search Tree
Binary Search Tree is one the data
structures that features fast searching, sorting, easy insertion and deletion.
Its also a sorted version of the binary tree. The tree works by appointing one
node and the data following the node is separated by their amount. If the data
is bigger than the node then the data goes to the right subtree and on the
other hand, the smaller data goes to the left sub tree. The system works
recursively so the sub-subbranch of the BST also sorts the data, which makes it
easier to search.
Operations
In BST there is 3 operations which
is find(x), insert(x), remove(x).
Find = finding the key (x) in the
BST
Insert = inserting a new key (x)
into the BST
Remove = removing key (x) from BST
· Find
Because the BST sorts the data adequately,
finding a key (x) is very easy. When we commence a search, we will begin at the
root and the program will compare the key to the root. If the data is bigger
than it will continue to the right subbranch after that it will also compare
the key to the data on the right subbranch if the key is smaller than it will
go to the left sub subbranch and so on.
· Insert
When inserting data, the first data
begin at the root if key is bigger than the root, insert to the right
subbranch, repeat it until an empty node to put the key. Remember that the key
will always be a new leaf.
· Remove
In removing a node, there are three
cases which needs to be considered. First, if the key is a leaf, the node can
be deleted directly. Second, else if the key is a node with one child delete
the node containing the key and connect the child with the new parents. Third,
if the key is in a node which has two children, find the right most child of
its left subbranch (z) and replace it the value (z) or alternately you can
choose the left most child of its right sub tree.
Comments
Post a Comment