My First Data Structure: Hash Tables

eeeeep
let michael = {
age: 45,
hobbies: ['ice hockey', 'improv'],
manager: true,
catchphrase: function() {
console.log('that's what she said!')
}
}
hash collision
recChar = (a) => {

let charMap = {}
for (let char of a) {
if (charMap[char]) {
charMap[char] += 1
} else {
charMap[char] = 1
}
}

for (let i = 0; i < a.length; i++) {
if (charMap[a[i]] > 1) {
return a[i]
}
}
}
recChar = (a) => {
let map = {}

for (let i = 0; i < a.length; i++) {
if(map[a[i]]) {
return a[i]
} else {
map[a[i]] = 1
}
}
}
hash browns!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store