Skip to content
Advertisement

Tag: data-structures

Finding highest parent in a tree structure

I have a tree structure that is made out of the data below. I need a search algorithm to find the top leader when I put in anyone’s _id value, regardless of leader or child. For example, if the input is “615e8215c3055d1addc216b0” (the id of Rahman) or “61164b4bc08f86505e7dcdd8” (the id of Aaron Aziz) it should return the id of “Aaron

JS Object Mapping Quesions

I’ve been trying to understanding this part of the code: at line 9. What does the “map[stack[stack.length-1]]” mean? At first I thought the map is an object, but I think you are supposed to add ” ” mark around the properties. Is map a data structure? if it is, How can I use this data structure? Answer Map is an

Advertisement