Question: Present an algorithm (in outline form) for inserting an element into a sorted linked list so that the list is always in sorted order. Do
Present an algorithm (in outline form) for inserting an element into a sorted linked list so that the list is always in sorted order. Do not utilize a sorting routine, but rather devise an insert (add) algorithm that will search the list and insert the new element in the proper place in the list so that the list is always in order. Assume that the objects involved all properly override both the equals (==) and the compareTo (>, <, >=, and <=) methods. The list is to be maintained in ascending order. Assume that the add method has the following signature. public void Add(E element) C#
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
