How to sort a linked list
I have a coding problem that requires me to sort an task that uses priority number and duedate. the higher the priority it should be infront. If it is an tie the closet date to now should be infront. this is my method for listing the tasks
5 Replies
How big is the list?
its dynamic. I really dont know how to explain it. there is not really a list but like you add as many values as you want
i could be one or three
It sounds like maybe you should be using a priority queue instead of a linked list?
If you do need to sort it, you can probably just use a simple bubble sort - even though that's normally a terrible sorting algorithm, if the list is not going to be very large it might be fine.