Postingan

Menampilkan postingan dari Maret, 2020

Hashing and hash table, Trees and binary tree

Hashing hashing is a technique used for storing and retrieving keys in a rapid manner. in hashing a value is transformed into a shorter value in a way in which it represent a key to that specific value, it is used to index and retrieve data in a way that it is faster that to search manually. hashing can also be defined as a concept of distributing keys in a table(array) using a hash function. Hash function some method to hash a function includes:- - mid-square:- * square the string and then use the appropriate number of bits from the middle of the square to obtain the hash-key - Division :- * divide the string using the modulus operator - folding :- * partition the string into several parts, then add the part together to obtain the hash key - digit extraction :- * predefined the digit of the given number is considered as the hash address - rotating hash :- * use any method of hashing then shift the digits to get a new address Collision there will be cases in which a cert...

Stack and Queue

Gambar
Stack concept data struct which stores data in an ordered matter. It is a linear data structure, elements are added and removed only at one end, which i called top. In a linked list we can use  linked list to implement this data structure, we can push and pop from one end. operation. push(x) :- push a new element pop():- remove an item from the top top:- reveal the top element Queue concept elements are entered through the rear and leave through the front, it follows the FIFO(first in first out) concept. we can use linked list to implement this data structure. operation. push(x):- push a new element through the rear pop():- pop an element through the front front():- return or reveal the front item prefix :- operator is written before operand infix :- operator is written between operand postfix :- operator is written after operand infix =  (10 + 5) * ( 10 - 5 ) / 2 prefix = * + 10 5 / - 5 10 2 postfix = 5 10 + 5 10 - 2 / * // idk if i'm wrong but i try with...