Samo Penic
2019-10-23 d01edec353d807771b8a903e45a578c747340213
Added missing to open addressing
1 files modified
48 ■■■■■ changed files
docker.html 48 ●●●●● patch | view | raw | blame | history
docker.html
@@ -83,6 +83,28 @@
    
}
function insertMissingIntoOpen(data_index){
    insert_idx=insert_index_without_collision;
    if(data_index==-1) data_index=insert_index_without_collision;
    hashval=hash(names[data_index]);
    console.log("f"+hashval);
    while(memory[hashval]!=-1) hashval=(hashval+1)%13;
    memory[hashval]=data_index;
    insert_idx++;
    if(insert_idx==8){
        alert("Completed!");
    }
    else {
        currentInner(document.getElementById("open1current"), insert_idx);
        el1=document.getElementById("o"+hashval);
        el2=document.getElementById("of"+hashval);
        el1.innerHTML=names[data_index];
        el2.innerHTML=phones[data_index];
}
}
function insertIntoMemory(data_index){
    if(data_index==-1) data_index=insert_idx;
@@ -101,6 +123,12 @@
    
        elll=document.getElementById("ll"+hashval);
        elll.innerHTML=elll.innerHTML+"<div class='linkedlist'>"+names[data_index]+"</div>";
        el1=document.getElementById("o"+hashval);
        el2=document.getElementById("of"+hashval);
        el1.innerHTML=names[data_index];
        el2.innerHTML=phones[data_index];
            
        memory[hashval]=data_index;
        insert_idx++;
@@ -109,6 +137,7 @@
        }
        else {
            currentInner(document.getElementById("s1current"), insert_idx);
            currentInner(document.getElementById("open1current"), insert_idx);
            currentInner(document.getElementById("currll"), insert_idx);
        }
    }
@@ -325,7 +354,24 @@
    <div class="step slide vsebina" data-x="2000" data-y="-3500" data-z="0">
    <h1 class="naslov">Open addressing</h1>
        <div id="open1current"></div><br />
        <button onclick="insertMissingIntoOpen(-1);">Insert</button>
        <br /><br />
        <span style="width:90px;height:100px;border:1px solid #000;margin:0px;display:inline-block;margin-left:-8px;"><div style="background:grey;color:white;font-size:18px">data[0]</div><div id="o0" style="font-size:18px">&nbsp;</div><div id="of0" style="font-size:11pt">&nbsp;</div></span>
        <span style="width:90px;height:100px;border:1px solid #000;margin:0px;display:inline-block;margin-left:-8px;"><div style="background:grey;color:white;font-size:18px">data[1]</div><div id="o1" style="font-size:18px">&nbsp;</div><div id="of1" style="font-size:11pt">&nbsp;</div></span>
        <span style="width:90px;height:100px;border:1px solid #000;margin:0px;display:inline-block;margin-left:-8px;"><div style="background:grey;color:white;font-size:18px">data[2]</div><div id="o2" style="font-size:18px">&nbsp;</div><div id="of2" style="font-size:11pt">&nbsp;</div></span>
        <span style="width:90px;height:100px;border:1px solid #000;margin:0px;display:inline-block;margin-left:-8px;"><div style="background:grey;color:white;font-size:18px">data[3]</div><div id="o3" style="font-size:18px">&nbsp;</div><div id="of3" style="font-size:11pt">&nbsp;</div></span>
        <span style="width:90px;height:100px;border:1px solid #000;margin:0px;display:inline-block;margin-left:-8px;"><div style="background:grey;color:white;font-size:18px">data[4]</div><div id="o4" style="font-size:18px">&nbsp;</div><div id="of4" style="font-size:11pt">&nbsp;</div></span>
        <span style="width:90px;height:100px;border:1px solid #000;margin:0px;display:inline-block;margin-left:-8px;"><div style="background:grey;color:white;font-size:18px">data[5]</div><div id="o5" style="font-size:18px">&nbsp;</div><div id="of5" style="font-size:11pt">&nbsp;</div></span>
        <span style="width:90px;height:100px;border:1px solid #000;margin:0px;display:inline-block;margin-left:-8px;"><div style="background:grey;color:white;font-size:18px">data[6]</div><div id="o6" style="font-size:18px">&nbsp;</div><div id="of6" style="font-size:11pt">&nbsp;</div></span>
        <span style="width:90px;height:100px;border:1px solid #000;margin:0px;display:inline-block;margin-left:-8px;"><div style="background:grey;color:white;font-size:18px">data[7]</div><div id="o7" style="font-size:18px">&nbsp;</div><div id="of7" style="font-size:11pt">&nbsp;</div></span>
        <span style="width:90px;height:100px;border:1px solid #000;margin:0px;display:inline-block;margin-left:-8px;"><div style="background:grey;color:white;font-size:18px">data[8]</div><div id="o8" style="font-size:18px">&nbsp;</div><div id="of8" style="font-size:11pt">&nbsp;</div></span>
        <span style="width:90px;height:100px;border:1px solid #000;margin:0px;display:inline-block;margin-left:-8px;"><div style="background:grey;color:white;font-size:18px">data[9]</div><div id="o9" style="font-size:18px">&nbsp;</div><div id="of9" style="font-size:11pt">&nbsp;</div></span>
        <span style="width:90px;height:100px;border:1px solid #000;margin:0px;display:inline-block;margin-left:-8px;"><div style="background:grey;color:white;font-size:18px">data[10]</div><div id="o10" style="font-size:18px">&nbsp;</div><div id="of10" style="font-size:11pt">&nbsp;</div></span>
        <span style="width:90px;height:100px;border:1px solid #000;margin:0px;display:inline-block;margin-left:-8px;"><div style="background:grey;color:white;font-size:18px">data[11]</div><div id="o11" style="font-size:18px">&nbsp;</div><div id="of11" style="font-size:11pt">&nbsp;</div></span>
        <span style="width:90px;height:100px;border:1px solid #000;margin:0px;display:inline-block;margin-left:-8px;"><div style="background:grey;color:white;font-size:18px">data[12]</div><div id="o12" style="font-size:18px">&nbsp;</div><div id="of12" style="font-size:11pt">&nbsp;</div></span>
    </div>