Skip to content
Advertisement

Creating a sorted link list out of a normal linked list

As I’ve just started programming a few months back a lot of new information is coming and I’m having trouble catching up.So here I have created what I thought was a sorted linked list.Turns out it is not sorted

JavaScript

The method works,it inserts the persons,but they arent sorted like they should be.What part of the code do I need to change/remove in order to make it sort.

Thanks!

Advertisement

Answer

You should insert like this:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement