C
C#7mo ago
StrixyBixy

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
No description
5 Replies
mtreit
mtreit7mo ago
How big is the list?
StrixyBixy
StrixyBixy7mo ago
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
StrixyBixy
StrixyBixy7mo ago
No description
StrixyBixy
StrixyBixy7mo ago
i could be one or three
mtreit
mtreit7mo ago
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.