sorting - LinkedList of objects added in alphabetical order according to object param -
what best way add together objects linkedlist in alphabetical order of 1 of objects parameters? have class takes in lastly name, first name, , other stuff. i've made object of class , parameters user submitted, , have store every object that's made linkedlist. objects must added linked list in alphabetical order according lastly name. best way this?
thanks!!
you binary search through list using “compareto” function find right index in insert new value.
the binary search consists in comparing middle element key value given key, in case, new element. if key match done, right index, if not value greater key value have search 1 time again left half of array, on contrary, search 1 time again right half
sorting object parameters linked-list alphabetical
No comments:
Post a Comment