Skip to main content

Posts

Showing posts from March, 2020

Pertemuan 6 Data Structure

Pertemuan 06 Data Structure, Binary Search Tree (L). Materi : - Binary Search Tree - Binary Search Tree Operations. Binary Tree Search Tree Binary Search tree is one kind of data structures that supports faster searching, rapid sorting, and easy insertion & deletion. Binary Tree has three basic operations which consist of find, insert and remove. Find Begins at root, recursively decided (if X is less than root's key then goes left, if X is more than root's key then goes right, if X equals root's key than it is found. Insert Begins at root. If X is less than node's key insert into left sub tree. if X is more than node's key, insert into right sub tree. operation is done recursively. Remove If the key that we want to remove is just a leaf, we just need to delete that node. Well, it starts getting complicated when we need to delete a node which has one child. In this case we need to delete the node an connect it's child to it's pa...
GSLC KE-2 Data Structure, Pertemuan ke-6 Materi : - Hashing and Hash Tables - Tree and Binary Tree Hashing and Hash Tables Hashing is a method used to store data so it can be added, search and delete in a short time. There are many ways of hashing.  Hash Functions : Mid-square : Squaring the value of key, taking the middle part. Division : (key) mod (value). Folding : Done by taking parts of a number, adding it, and ignoring some digits of it. Digit Extraction : Extract some digit from a number. for example, given x=219382. We want to extract some of it's digit and make it a hash key, so we extract 1st digit and 4th digit. From that the number we get is 23.  Rotating Hash : Do any of the method above, then rotate the digit. For example, given that x=23354. If we rotate x, it would be 45332. In some case, Collision will happen... What is a collision ? Collision is when several data have the same hash-key. What can we do to handle it ? Line...

Pertemuan III Mengenai pengaplikasian Linked List

Linked List, banyak hal dapat dilakukan dalam linked list, seperti push(insert), pop(delete). memahami konsep Singly Linked List dapat dibilang relatif mudah, namun pengaplikasian kodingnya perlu waktu untuk pemahaman. Saya Johanes Peter akan merangkum apa yang diajarkan di kelas besar pertemuan 3, yaitu mengenai koding linked list. Struct struct Data {     int value;     struct Data *next,*prev; }*head,*curr,*tail; Push tail (insert sebuah data di paling belakang) void push(int a) {     curr = (struct Data*)malloc(sizeof(struct Data));     curr->value = a;     if(head==NULL){         head = tail = curr;     }     else{         tail->next = curr;         curr->prev = tail;         tail = curr;     }     head->prev = tail->next = NULL; } Print isi dalam...