Answer the question
In order to leave comments, you need to log in
How to sort an array so as to turn it into a tree structure?
const variants = [
['0', 'Slate', 'Single'],
['1', 'Slate', 'Single'],
['2', 'Slate', 'Single'],
['3', 'Slate', 'Single'],
['4', 'Slate', 'Single'],
['5', 'Slate', 'Single'],
['0', 'Slate', '3-Pack'],
['1', 'Slate', '3-Pack'],
['2', 'Slate', '3-Pack'],
['3', 'Slate', '3-Pack'],
['4', 'Slate', '3-Pack'],
['5', 'Slate', '3-Pack']
]
Answer the question
In order to leave comments, you need to log in
The author, well, you set motivating tasks. All data structures are with anonymous fields. So how do you write an algorithm? There is a tuple with three fields. The first field is without a name .. the second is without a name.
I could at least make an effort to get it done.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question