Java how to sort a Linked List?

后端 未结 9 2008
耶瑟儿~
耶瑟儿~ 2020-12-03 03:00

I am needing to sort a linked list alphabetically. I have a Linked List full of passengers names and need the passengers name to be sorted alphabetically. How would one do t

9条回答
  •  情深已故
    2020-12-03 03:42

    If you'd like to know how to sort a linked list without using standard Java libraries, I'd suggest looking at different algorithms yourself. Examples here show how to implement an insertion sort, another StackOverflow post shows a merge sort, and ehow even gives some examples on how to create a custom compare function in case you want to further customize your sort.

提交回复
热议问题