Postingan

Menampilkan postingan dari Mei, 2018

HASHING

1.      LINEAR PROBING Dengan menambahkan suatu interval pada hasil yang diperoleh dari fungsi  hash  sampai ditemukan lokasi yang belum terisi. Berikut Sourcodenya: table=[None]*11 def hash(x):     return x%11 def insert(table,key,value):     index = hash(key)     if table[index] == None:         table[index]=value     else:         collusion=index         found = False         ind = collusion+1         if ind>=len(table)-1:             ind = 0         while (ind<=len(table)-1)and not(found):             if table[ind]==None:                 found = True                 table[ind]=value             ind = ind+1              def search(cari,table):     found = False     keluar = False     ind = hash(cari)     if ind>=len(table)-1:         ind = 0     elif not found and ind:         print('Data tidak ditemukan')     while (ind<=len(table)-1)and not(found):         if table[ind]==cari:             print('