Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
PyQP
#python 3.6.9 #PyQP: understanding Quadratic Probing in hashing #this code is created by Rezaul Hoque on September 09,2022. #contact:jewelmrh@yahoo.com;Dhaka,Bangladesh;https://rezaulhoque.wordpress.com,https://hoquestake.blogspot.com #note: codes shared by Rezaul Hoque on rextester are not for sale; they are created and shared to facilitate the algorithm learning process; many like Hoque use this platform to practice programming ;Rezaul hopes his contribution helps others to fine tune their learning; class QP(object): def __init__(self,a1,a2,n): self.a1=a1 self.a2=a2 self.n=n def hashing(self,htab,val,tsz): for k in range(self.n): h=a1[k]%tsz if(htab[h]== -1): htab[h]=a1[k] val[h]=a2[k] else: for i in range(tsz): q=(h+i*i)%tsz if(htab[q]==-1): htab[q]=a1[i] val[q]=a2[i] break for k in range(self.n): print(f" {htab[k]}\t{val[k]}") a1=[700,103,107,109,111,113,115] a2=[90,32,24,51,70,30,11] N=7 SZ=7 htab=[0]*7 val=[0]*7 for k in range(SZ): htab[k]= -1 val [k] = -1 qh= QP(a1,a2,7) qh.hashing(htab,val,7)
run
|
edit
|
history
|
help
0
Hello world
Tupples
GoogleCodindQues.py
linked_lists_2
benda x guna
Dont know, Dont care
course 2 steve sch
P
HW Descending order
Python: Functions I : Functions with messages.