Hashtables

Developer
Size
1,836 Kb
Views
4,048

How do I make an hashtables?

What is a hashtables? How do you make a hashtables? This script and codes were developed by Ajala Comfort on 11 January 2023, Wednesday.

Hashtables Previews

Hashtables - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Hashtables</title>
</head>
<body> <script src="js/index.js"></script>
</body>
</html>

Hashtables - Script Codes JS Codes

function HashTable(){ this.data = new Array(137),this.values = []; this.Hash = function(stringdata){ const H = 37; var total = 0; for(var i = 0;i < stringdata.length; ++i){ total += H * total + stringdata.charCodeAt(i); } total = total % this.data.length; if(total < 0){total += this.dat.length + 1} return parseInt(total); } this.show = function(){ this.data.forEach(function(val,i){ if(val !== undefined){console.log(i,val)} }) return ; } this.put = function(key,str){ var pos = this.Hash(key); if(this.data[pos] == undefined){ this.values[pos] = key;this.data[pos] = str; return; } while(this.data[pos] !== undefined){pos++;} this.values[pos] = key;this.data[pos] = str;return; } this.get = function(key){ var hash = -1;hash = this.Hash(key); if(hash > -1){ for(var i = hash; this.data[i] !== undefined;i++){ if(this.values[hash] == key){return this.data[hash] + " ; " + this.values[hash]} } } return undefined; }
}
var names = ["David","Jennifer","Donnie","Raymond","Cynthia","Mike","Clayton","Danny","Jonathan"];
var hash = new HashTable();
names.forEach(function(name){hash.put(name.substring(0,2),name)})
//hash.show();
var name = "Comfort";
Hashtables - Script Codes
Hashtables - Script Codes
Home Page Home
Developer Ajala Comfort
Username AJALACOMFORT
Uploaded January 11, 2023
Rating 3
Size 1,836 Kb
Views 4,048
Do you need developer help for Hashtables?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Ajala Comfort (AJALACOMFORT) Script Codes
Create amazing love letters with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!