8 ms·
Uh… what? It’s quite the opposite; why would you need a class for linked lists and trees?
by eitacaraleo 3y ago
Uh… what? It’s quite the opposite; why would you need a class for linked lists and trees?
- hasty_pudding 3y agoYou definitely need generic node objects to define the nodes. You could have a completely stateless class/object that would manipulate those nodes and add them and remove them from the data structure.
- metaxy2 3y agoWell, in principle you could have the node objects be created with an object literal in an outside builder function, and the manipulation also be done by outside functions. That's how it's done in languages without OOP. The question is how far are you willing to go to avoid doing anything that looks like OOP.
- hasty_pudding 3y agoVery far
- recursive 3y agoTo provide an easy place to find the behaviors that are included with those data structures.