Posts

Showing posts from March, 2020

Data struct Binary Search Tree

Image
Nama: Dea Claresta Nim: 2301863736 In computer science,  binary search trees  ( BST ), sometimes called  ordered  or  sorted binary trees , are a particular type of container: a data structure that stores "items" (such as numbers, names etc.) in memory. They allow fast lookup, addition and removal of items, and can be used to implement either dynamic sets of items, or lookup tables that allow finding an item by its  key  (e.g., finding the phone number of a person by name). Binary search trees keep their keys in sorted order, so that lookup and other operations can use the principle of  binary search : when looking for a key in a tree (or a place to insert a new key), they traverse the  tree from root to leaf, making comparisons to keys stored in the nodes of the tree and deciding, on the basis of the comparison, to continue searching in the left or right subtrees. On average, this means that...

Hashing table & Binary Tree.

Image
Nama :Dea Claresta Nim:23018637376 Hashing is a technique used for storing and retrieving keys in a rapid manner hash table is a table(array) where we store the original string. A  hash function  is any  function  that can be used to map  data  of arbitrary size to fixed-size values. The values returned by a hash function are called  hash values ,  hash codes ,  digests , or simply  hashes . The values are used to index a fixed-size table called a  hash table . Use of a hash function to index a hash table is called  hashing  or  scatter storage addressing . The two heuristic methods are   hashing by division  and  hashing by multiplication  which are as follows: The mod method: In this method for creating hash functions, we map a key into one of the slots of table by taking the remainder of key divided by table_size. That is, the hash function is h(key) = key mod table_size i.e. key ...

RANGKUMAN LINKED LIST DAN DOUBLE LINKED LIST

Image
NAMA: DEA CLARESTA NIM: 2301863736 TUGAS 2(RANGKUMAN KELAS) Selamat malam pak, hari ini dari kelas besar data structure, saya mempelajari pengkodingan linked list dan double linked list. Dimana linked list ada 3 bagian, yaitu head, current, dan tail, dimana setelah tail selalu =NULL. Posisi head selalu berada di depan rantai , dan tail ada di paling belakang rantai. Current bisa berpindah pindah ke posisi manapun. Lalu dalam double linked list, saya belajar jika setiap rangkai tidak hanya bisa berjalan ke depan, tapi dengan double linked list, rantai mampu berjalan kedepan dan kebelakang secara sekaligus, dalam double linked list, head->prev= NULL, dan tail>next=NULL Untuk membuat linked list , kita harus membuat struct   terlebih dahulu, dikarenakan kita akan menggunakan pointer dari variabel-variabel dalam struct. Lalu saya mempelajari push depan, dimana saya bisa menyelipkan rantai di paling depan rantai Lalu saya mempelajari push belakang, dimana s...

Data Struct Linked List 2

Image
Nama: Dea Claresta Nim: 2301863736 1.        Circular single linked list Circular linked list  is a linked list where all nodes are connected to form a circle. There is no NULL at the end. A circular linked list can be a singly circular linked list or doubly circular linked list. Advantages of Circular Linked Lists: 1)  Any node can be a starting point. We can traverse the whole list by starting from any point. We just need to stop when the first visited node is visited again. 2)  Useful for implementation of queue. Unlike  this  implementation, we don’t need to maintain two pointers for front and rear if we use circular linked list. We can maintain a pointer to the last inserted node and front can always be obtained as next of last. 3)  Circular lists are useful in applications to repeatedly go around the list. For example, when multiple applications are running on a PC, it is common for the operating system t...