1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

List Sorting Question

Discussion in 'C++' started by Polystyrene, Aug 31, 2010.

  1. Polystyrene

    Polystyrene New Member

    Joined:
    Aug 31, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    I have a program that relies on a sorted list of data structures. During program execution the list is initially sorted using list::sort however I continually need to add new unsorted data structures into the list. I initially just used the list::push_back function to append all of the additional data structures to the end of the list and then run sort on the entire list. My question is would it be faster to make a smaller list containing the new data structures, sort it, and then merge it into the larger list. This adding new data and sorting is by far the slowest part of my program and I am looking for ways to speed it up. Any suggestions would be greatly appreciated
     

Share This Page