I have two lists - let's call them details and totals.
The items in details have multiple elements for each key that the list is sorted on, as such:
KEY1
KEY1
KEY2
KEY2
KEY3
KEY3
KEY3
etc
The items in totals will only have each key once, as such:
KEY1
KEY2
KEY3
etc
Both lists are sorted by key already. The lists need to be combined so that the new list has the details elements followed by it's corresponding element from totals, as such:
KEY1 (this is from details)
KEY1 (this is from details)
KEY1 (this is from totals)
etc
Which sorting algorithm will result in the best performance in this scenario?
(in all honesty, I'm just going to change the code so that the row from totals is created-and-inserted as the details list is being built, this is more of an academic question)