[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
C++ algorithms
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 28
Thread images: 3
File: algos.jpg (40 KB, 500x622) Image search: [Google]
algos.jpg
40 KB, 500x622
Is there a good algorithms book with examples written in modern C++ (that's using all the recent additions to C++)?
>>
>>53349211
interested too
>>
>>53349211
> C++11
But you don't need move semantics, variadic templates, and smart pointers to implement BSTs, heaps, sorts, and tree traversals.

It kinda sounds like you're new to C++ and algorithms in general. For learning algorithms, you really shouldn't have to worry about the language syntax details.

Btw, and implemention of these things in!C++ will mostly look like it would in C.
>>
>>53349684
there are things you can do using new C++ to speed up algorithms
>>
>>53350087
assembly and c destroys anything in speed
>>
>>53350122
in the real world the speed of writing the code also counts

and I'm not so sure C is reliably faster anymore
>>
>>53350122
git gud faggot
>>
>>53350233
>quoted wrong fuck
git gud faggot
>>
>>53349211
Step 1: learn the concept of programming
Step 2: learn the math of algorithms and running times
Step 3: look at pseudocode for proven algorithms

Congratulations you can now write algorithms for any language. If you can't, then programming may not be for you.
>>
>>53350087
> in a magical world I have no idea about, I'm sure it's possible! People said C++11 had all these new performance features!
> I just didn't know what they are yet
It does, but most if not all won't apply to what you're thinking about.

Care to prove me wrong?

Compile time computations via constexpr functions (not as useful until C++14) aren't really going to apply here if we're talking runtime sorts, tree/graph traversals, etc.
>>
>>53350329
>Congratulations you can now write algorithms for any language.
= you can't write anything in any real world language
>>
File: 1455954739054.jpg (39 KB, 500x343) Image search: [Google]
1455954739054.jpg
39 KB, 500x343
Fuck C++, what about Rust ?
>>
most algorithm books are written using java for examples, but i've always thought basic C was better suited for learning them.

i guess the Skiena book uses C and I've heard good things about it.

There's a version of Sedgewick using C++, btw, OP.
>>
File: le stumped trump.jpg (96 KB, 342x465) Image search: [Google]
le stumped trump.jpg
96 KB, 342x465
>>53350122
SBCL is faster than C.
>>
>>53352637
>>reptile eyes
>tfw Murica can actually elect a psychopath president
>>
>>53352637
>t. Rubotcuck
>>
Learn the algorithms and then just implement them using the new features
>>
I used this book for my algorithms course I really liked it. All the examples in here are in java but unless you're new to programming you should be able to implement them in any language you want

there isn't really a lot of java specific stuff in this book
>>
>>53351347
>most algorithm books are written using java

Only the really shitty ones.
>>
>>53350087

No, the new stuff in C++11/14 really just make things faster to code.
>>
>>53349684
>using smart pointers
kek, fucking casual
>>
>>53349211
If you understand the algorithms, you shouldn't need/want more than pseudocode. Only retards demand copy-pastable source code
>>
>>53352796
The other choices are a psychopath that has a history of deceit and evil, and a commie who's so dumb he thinks calling himself an honorary woman will help him gain female voters over an actual woman.
>>
>>53353855
The difference is that I'm pretty sure she's a pro and unlike spoiled brat psychopath will more or less respect the boundaries as politicians learn. Her husband was a pretty good president, even worked a lot with the other side and got a lot of shit done.
>>
>>53353722
bullshit, there are some tricks you can do now that also speed shit up

3 years ago I knew exactly what they were :)
>>
the algorithms which use Java basically use it like C
If it was C++14 it would be a shitshow

I have that OP book, it is really nice
>>
>>53353770
>>> implying
>> implying
> implying
>>
>>53349211
The best books on algorithms use pseudocode to convey implementations.

Searching high and low to find the one book using a specific version of a specific language is just doing yourself a disservice; it is sure to be subpar in comparison to the best learning resources out there on this subject (all of which use pseudocode and don't clutter things up with language specific details).

Besides, do you really want to end up like all the other C++ fizzbuzzers in this thread that have no idea what they're talking about? Learn C++ properly and separately from algorithms using the proper resources, and then, if you must, figure out the best way to translate that algorithm pseudocode into C++ yourself.

Btw, this smells like
> someone help me with my algorithms class homework; the prof said the code we turn in has to be C++!
Thread replies: 28
Thread images: 3

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.