I have a vector of a data structure i want to sort. My program works good, but when the amount of structures goes up, the program takes fucking ages to work. I don't want to piss around with bullshit sorting algorithms like bucket sort
I'm thinking about ordering it every time a new structure comes in. Whats the fastest way to order a vector of structures in c++?
Name:
Anonymous2007-11-25 21:43
Assume they come in in sorted order.
[quote]but when the amount of structures goes up, the program takes fucking ages to work. I don't want to piss around with bullshit sorting algorithms like bucket sort[/quote]
LOL I WANT 2 HAVE A BETTER SORTING ALGORITHM, BUT I DON'T WANT TO ACTUALLY IMPLEMENT A BETTER ONE.
There are data structures that do this for you, such as RBT
Name:
Anonymous2007-11-25 21:47
>>4
Considering OP doesn't even want to use something as simple as bucket sort, I doubt he's gonna want to do something like an RBT.
Name:
Anonymous2007-11-25 22:09
>I'm thinking about ordering it every time a new structure comes in.
Like... a tree?
You need to spend more time reading up on data structures and algorithms.
>>1
>My program works good, but when the amount of structures goes up, the program takes fucking ages to work.
>My program works good works good
I don't know which makes you sound more like a fucktard, not wanting to "piss around" with sorting algorithms or your shitstain grammar.
Name:
Anonymous2007-11-25 22:32
>>1
Either:
1) Use std::sort
2) Use an std::list and call the sort method after each insertion
3) Use an std::set to store the data (std::set uses some sort of self-balancing bst to store keys) 4) Read SICP
>>9
I second the suggestion to use a std::set. It's typically implemented with an RBT, which is nice. The catch is that you need to define an operator< for the struct you want to throw in there.
Name:
Anonymous2009-03-06 9:02
The only rules we have are remain anonymous and stay home Anyways I was about to say and then I try to escape from a old java thread I was trying to get at.
Name:
Trollbot90002009-07-01 11:13
have commented on various occasions about the buffer length as it should be good enough for government use it everyday at work so I definitely notice a difference other than the Java one You look down and he was violenly humping it Not like one of its explicit constructors.