Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
javaLP
//'main' method must be in a class 'Rextester'. //openjdk version '11.0.5' ////////////////////////////////////////////////////////////////////////////////javaLP:Linear probing in java //this code is created by Rezaul Hoque on September 18,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; ////////////////////////////////////////////////////////////////////////////// import java.util.*; import java.lang.*; class Demo{ int[] k=null; int[] a=null; public Demo(){ } public Demo(int[] e,int[] r){ this.k=e; this.a=r; } public void Hash(){ int[] tab=new int[7]; int[] val=new int[7]; for(int i=0;i<7;i++) { tab[i]=-1; val[i]=-1; } for(int i=0;i<7;i++){ int h=k[i]%7; if(tab[h]==-1){ tab[h]=k[i]; val[h]=a[i]; } else{ for(int j=0;j<7;j++){ int q=(h+j)%7; if(tab[q]==-1){ tab[q]=k[j]; val[q]=a[j]; break; } } } } System.out.println("Index Value"); System.out.println("---------------------"); for(int m=0;m<7;m++){ System.out.printf("%d\t%d\n",tab[m],val[m]); } } } class Rextester { public static void main(String args[]) { int[] x=new int[]{10,9,8,15,19,1,21}; int[] y=new int[]{30,41,45,19,15,5,3}; Demo s=new Demo(x,y); s.Hash(); } }
run
|
edit
|
history
|
help
0
rd dap da
Smallest Multiple of N with Zeros and Ones
print alphabets using stars
Add Two Numbers saved in linked lists
susun
JLF
Coding Numbers - Duplicate - Array
2_Arpan Subba_Lincoln.java
JavaQ5b
Test.java