Posts

Showing posts from March, 2020

Binary Search Tree

Halo semuanya, pada postingan sebelumnya saya suda menjelaskan sekilas mengenai konsep Binary Tree. Pada postingan kali ini saya ingin menjelaskan soal searching pada Binary Tree. Searching disini menggunakan teknik rekursif ya man teman. Algoritmanya cukup sederhana, jadi apabila root (ibaratnya current) ketemu sama key (kata kunci) yang ingin kita cari, maka return root, or else geser. Itu saja sih man teman, makasi yaa. struct node* search( struct node* root, int key) {      // Base Cases: if the root is null or key is present at root      if (root == NULL || root->key == key)         return root;             // If key is greater than root's key      if (root->key < key)         return search(root->right, key);          // If key is smalle...
Image
Hashing Table & Binary Tree Halo, halo.. Hari ini saya akan menjelaskan sesuatu yang lebih advanced nih ke kalian, namanya adalah Hashing Table dan Binary Tree. Jadi, mereka tuh adalah suatu metode pengelompokkan data untuk mempercepat proses searching . Bayangin, nih. . Udahlah kita semakin percepat proses searching data dari segi algoritma, kita nambahin lagi dari segi penyimpanannya, proses pengolahan data pasti makin cepat dong. Jadi, bedanya mereka apa :? Hash Table Apa sih yang dimaksud dengan Hash Table? Jadi Hash Table, itu suatu metode pengolompokan data dimana data data yang relevan dikelompokkan dalam sesuatu yang namanya Hash. Untuk apa? Hashing Table itu bakal mengelompokkan data-data yang relevan itu ke dalam suatu kelompok jadi gampang pas searching. Mereka tuh mirip kaya kamus, dimana kata dengan awalan yg sama dikelompokin ke section yg sama. Nah, gmana cara kelompokannya?  Nah, tahukah teman-teman kalau Hashing sendiri, kerap diterapkan didalam du...
Image
Linked List 2 : Single Linked List Hello Guys, back with me again. After the opening of last week, I would like to tell you guys about the commonly used "module?" used in Linked List. Alright, lets get to it XD --First of all there is to main method we will use in the code which is Malloc -> sort of like reserve a certain memory space to be used Free -> release the memory space that you reserved Sizeof -> see the size of an object/variable --In linked list, we normally use module such as Print, Pop-deletion & Push-insertion. Look at following code. Note that we always initiate current with Malloc at the beginning of the module. That serves as a container for the new value to be inserted to the record.  To be noted here in Pop function also, we should always free up the memory space if we no longer uses the memory to prevent the record from bulking in size. That's it for today, stay tuned for more!