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!

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Java ThreadLocal

Buy Verified Cash App Account with BTC Enable

T-REX MINER 0.25.12 UNLEASHED LHR UNLOCK

Learn how to read mails in Python

Nuxt 3 and Django RestFramework works in Docker

Which startups are using Ruby on Rails now?

Narrow Integration Testing in Go

Java Script string.concat()

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
HopeGiometti

HopeGiometti

More from Medium

How To Raise Really Good Pull Requests(PR)

Why Soft Skills Matter When Hiring a Software Developer

Why Soft Skills Matter When Hiring a Software Developer

How I approached a system design problem as an intern

Wells Fargo — Software Developer