Subversion Repositories programming

Rev

Rev 7 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7 Rev 8
Line 130... Line 130...
130
    //Method to implement linear probing
130
    //Method to implement linear probing
131
    //Precondition: h != null; i != null
131
    //Precondition: h != null; i != null
132
    //Postcondition: return the next place to try and put the value
132
    //Postcondition: return the next place to try and put the value
133
    private int nextProbe(int h, int i) {
133
    private int nextProbe(int h, int i) {
134
        return (h + i)%entries.length;      // Linear Probing
134
        return (h + i)%entries.length;      // Linear Probing
-
 
135
	
-
 
136
    	//return (h + (i * 3 ))%entries.length; //Prime Probing ( p=3  )
-
 
137
	//return (h + (i * 5 ))%entries.length; //Prime Probing ( p=5  )
-
 
138
	//return (h + (i * 7 ))%entries.length; //Prime Probing ( p=7  )
-
 
139
	//return (h + (i * 11))%entries.length; //Prime Probing ( p=11 ) 
-
 
140
    
-
 
141
        //return (h + (i * i ))%entries.length; //Quadratic Probing
-
 
142
 
-
 
143
	// STILL NEED TO ADD DOUBLE HASHING IMPLEMENTATION HERE
-
 
144
    
135
    }
145
    }
136
 
146
 
137
    //Method to rehash the entire table.  This will get rid of NIL's
147
    //Method to rehash the entire table.  This will get rid of NIL's
138
    //Precondition: none
148
    //Precondition: none
139
    //Postcondition: entries will be twice the size plus one (ensures odd size)
149
    //Postcondition: entries will be twice the size plus one (ensures odd size)