Java: What is the best way to traverse and insert element into a ranked linked list?

Due to the frequent insertions and deletions at the head and tail of the linked list, I have chosen to use the linked list from the Java API. And the linked list will be ranked in descending order, i.e.

LinkedList mylinkedlist = new LinkedList();

Myobject new_value = new MyObject(95);

100,98,97,95,90

Occasionally I have to insert elements into this linked list(not at the head and tail). Because the linked list must be in descending order, I have to traverse the linked list in descending order from the head or ascending order from the tail...

Read More »

By: StackOverFlow - Sunday, 15 April

Related Posts