JavaScript interview with a Google engineer: Efficient lookup

preview_player
Показать описание


Рекомендации по теме
Комментарии
Автор

Not having the audio synced up made it hard to follow along. Here's a fix:
pull up the video in two different tabs. Mute one and fast forward about 29 seconds. Watch that one while listening to the other one in background.

zachholub
Автор

Can you guys sync up the audio before you upload plese

yathuarulnanthy
Автор

can you sync the audio? it's very common in your videos to hear interviewee typing for seconds before we suddenly see a bunch of code

anathema
Автор

nice touch with "in chinese it's like 3000", while chinese is not a phonetic language and this particular problem is completely irrelevant for chinese :)

z
Автор

I don't understand the discussion of array vs object at 23:30. . For most situations array is O(N) lookup but in a trie, we are not going to be scanning for every character in the children array

For english, a will be in zeroth, b in first index and so on. So if we search for "bat". It will be looking for first index, then zeroth of child (of "b" node) then 19th character (for 't") for child of "a" ("t".charCodeAt(0) - 97 gives 19 as the index of the child of "a") . It is pretty straightforward to do that math and no need to store a hashmap. So IMHO, that discussion was meaningless.


Additionally, I don't understand why the interviewee is taking the `substr` which is an O(n) operation at every recursive call as a new string is generated. Better to just pass char array + current index

RaoVenu