/**
* AlgoDat SoSe2000, Aufgabe 63
* Hashtabelle
* Reihenfolge des Einfuegens
{ 9,24,73,18, 3, 6,11}
{24, 9,73,18, 3, 6,11}
{24,73, 9,18, 3, 6,11}
{24,73,18, 9, 3, 6,11}
{24,73,18, 3, 9, 6,11}
{24,73,18, 3, 6, 9,11}
{24,73,18, 3, 6,11, 9}
* @author Christian Semrau
* gsemrau@cs.uni-magdeburg.de
*/
class ChS_Aufg63 {
int[] feld;
int size;
public ChS_Aufg63(int size) {
feld = new int[size];
this.size = 0;
}
public boolean equals(Object obj) {
if (obj!=null && obj instanceof ChS_Aufg63){
ChS_Aufg63 o = (ChS_Aufg63)obj;
if (feld.length==o.feld.length){
for(int i=0; i=feld.length) return false;
int h = hash(k);
while (feld[h]!=0)
h=(h+1)%7; // naechsten Index bestimmen
feld[h] = k;
size ++;
return true;
}
public static void main(String args[]) {
System.out.println("Aufgabe 63");
ChS_Aufg63 comp = new ChS_Aufg63(7);
comp.feld = new int[]{6,11,9,24,73,18,3};
int[] zahlen = new int[]{3,6,9,11,18,24,73};
while(zahlen!=null){
ChS_Aufg63 test = new ChS_Aufg63(7);
test.insert(zahlen);
if (test.equals(comp))
System.out.println(mathe.Perm.feldOut(zahlen));
zahlen = mathe.Perm.nextPerm(zahlen);
}
}
}