Skip to main content

Review

POINTER

Pointer is a type of variable in C. It differentiate from other variable is that it can contain the memory address of other variable. Pointer can be declared as such :

int *ptr; -> ptr is a pointer that point to a variable that contain an integer.

Pointer can also point to another pointer and is called double pointer.

ARRAY

Array is a type of data structure that can store a fixed amount of variable. In shorter term array is a collection of variable that has the same data type. Array can be declared as such :

int arr[10]; -> arr is an array of integer that can store a maximum of 10 integer.


LINKED LIST

Linked is a type of data structure that store it's data in a node(struct) that is connected together via link. Each node contain a reference to the next node and/or a reference to the previous node. Linked List is second most used data structure after array.

There are two most used type of linked list :
1. Single Linked List
2. Double/Doubly Linked List

The difference is that Single Linked List only contain the reference to the next node, and Double Linked List contain 2 reference each pointing to the next and previous node.

 HASH TABLE

Hash table is a type of data structure that implement associative array abstract data type. Basically it's a structure that map a key to a value. It do this by using using a function called hash. The key generated by the function is used to map the value. This will speed up searching because by finding the key you also find the value map to it. There are may hash function like :
  1. Division
  2. Multiplication
  3. Digit Extraction
  4. Etc
Now there is something called collision handling in has table. Basically it's a method that you use when there are 1 key that correspond with 2 or more value. There are 2 used method that is :
  1. Separate Chaining : See the source image
  2. Linear Probing :


BINARY SEARCH TREE (BST)

BST is a type of data structure that implement a tree. Meaning that it consist of a root and 2 subtree that is the left and right. The left subtree is smaller in value than the root and vice versa for the right subtree. BST is used because it allow for fast lookup/search because of it's sorted nature it allow for binary search and there for faster. O(log n) for best result and O(n) for the worst result.

BIBLIOGRAPHY


Comments