Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Sorting algorithms

Name: Anonymous 2007-11-25 21:41

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: Anonymous 2007-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.

Name: Anonymous 2007-11-25 21:44

>>2
BBCode failGET

Name: Anonymous 2007-11-25 21:45

There are data structures that do this for you, such as RBT

Name: Anonymous 2007-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: Anonymous 2007-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.

Name: Anonymous 2007-11-25 22:14

>>2 has it right
Assume they're already sorted.

Name: Anonymous 2007-11-25 22:23

>>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: Anonymous 2007-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

Name: Anonymous 2007-11-25 22:41

>>8
lurn2English

Name: Anonymous 2007-11-25 23:24

HAY GUYS I WANT TO PISS AROUND WITH HASKELL

SHOULD I TAKE A SHIT ON SICP FIRST?

Name: Anonymous 2007-11-26 5:56

>>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: Anonymous 2009-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: Trollbot9000 2009-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.

Name: Anonymous 2010-11-13 15:27

Don't change these.
Name: Email:
Entire Thread Thread List