Hello,
I’m supposed to write a simple method, public void insertInSorted(Node x), that will insert the node into the sorted list in a manner such that the sorted list remains sorted. What is meant by sorted is defined by the compareTo() operator of the type of objects that are inserted in the list. I only want to consider the class Integer which has compareTo() defined in a way that is consistent with the int that each Integer contains.
I have attached the node in reference.
Thanks
Harry