Message from JavaScript talks

May 2017

— That check above never runs if these don't pass:

// Deduce if the String is definitely not in the Set from basic data.

if (charArray.length !== 0

    && uniquesLength !== 0

    && listLength !== 0

    && list.hasOwnProperty(charArray[0])

    && list[charArray[0]].hasOwnProperty([charArray.length])

  ) {

Message permanent page

— 

For "Hello", it checks for this type of path in the set:

{
H: {
5: {
// Word may exist in here
}
}
}

— So as you can probably tell, construction of the set dictates where in the set we conduct the search

— Of course if you have a set with only words which start with H, and are of all the same length, it will be only as effective as a linear search on a flat array

Message permanent page

— But for diverse datasets, this will improve search efficiency massively

— You could also target by multiple letters, instead of just the first. I'm not sure how much more effective that would be

Message permanent page

— All these checks are ordered from "least expensive" to "most expensive" too, so if we can deduce that the string is not in the set from a less expensive method, we just saved time :D

Message permanent page

— Put in js file, and module.exports the class

— Should follow this api:
s = new Set()
s.add(str)
s.has(str)
s.delete(str)

— Sure

— Made the test better

— I am eager to see if it is slower or faster