Reputation: 73
Before you ask, yes, I must use a list. I can not use a slice or anything else. So, I have a list full of structures, but the list needs to be sorted based on the lastname variable of the struct. I've tinkered with things but ultimately have nothing to show for it. I'm not asking for an answer, but just some guidance in the right direction. Any help would be appreciated!
Upvotes: 1
Views: 122
Reputation: 464
So since you have to use a golang list, I'd recommend looking into
list
documentation for Go, especially the functions that move elementsSolutions involving slices likely won't help you since you'll have to do linked list comparisons (and Go's implementation of lists is a little complicated!) Another hint: you'll likely have to do for loop
iterations, so expect some O(n^2) complexity.
Hope this helps! :)
Upvotes: 4