You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+13Lines changed: 13 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -24,3 +24,16 @@
24
24
multipleSelect
25
25
/>
26
26
27
+
Technical Chellenge
28
+
Initially I used recursion and this was the biggest mistake since js doesn't support tail optimization. When the data becomes too big with many nested level of data. The browser actually will crash.
29
+
30
+
Solved by:
31
+
-> Instead of using recursion, use iteration.
32
+
-> To reference node faster, instead of doing a binary search the entire tree, we use hash map with key as id of the node
33
+
-> When update state, instead of creating a new version of the data we use the hashmap to update ( since in js object is referenced not copied )
34
+
35
+
I know this is against data mutation best practice but for performance we must mutate all the way.
0 commit comments