### silverfish's blog

By silverfish, history, 4 weeks ago, ,

CP3 has some solid implementations of common data structures, such as UFDS, Segment Trees, Fenwick Tree, etc. It also has some nice implementation of algorithms such as Suffix Array,Lowest Common Substring Array, and many others I haven't got around to reading yet. The thing in common with CP3 implementations is that they're all very C style codes. (geeksforgeeks also has similar implementations)

On the other hand I also use cp-algoritms.com for learning, and they also have very good implementations that use much more 'modern' code. For example CP3 always uses basic arrays, and C style string manipulation, whereas cp-algorithms uses the c++ std::vector and std::string classes.

I know style implementations are usually faster as they are less bulky, but they're also harder to deal with, and as a result, you can make mistakes easier.

So my questions are: Which should I use? Is there actually a noticeable difference at all between the two?

Thanks for anyone who read this whole thing!

(maybe I'll try submitting some problems with both CP3, and cp-algorithms implementations, and see which one has faster runtimes)

in both images the top one is the cp-algorithms, while the bottom one is the CP3 implementation. For the first problem is |s| <= 100000, for the second |s| <= 400000. The CP3 uses the same sized predefined for both, thats why it uses so much space for the first one.

• +2

 » 4 weeks ago, # |   0 Auto comment: topic has been updated by silverfish (previous revision, new revision, compare).
 » 4 weeks ago, # |   0 Did you mean "https://cp-algorithms.com/" ====> Cp3 ..Because I dont know about cp3.Could you please share the link for cp3?Thanks
•  » » 4 weeks ago, # ^ |   -6 https://www.goodreads.com/book/show/22820968-competitive-programming-3 CP3 : Competitive Programming 3 by Steven Halim, Felix Halim Its a book on competetive programming that was made mostly for ICPC contestnts I think, but it has some great information.
•  » » » 4 weeks ago, # ^ |   0 ok.Thanks a lot for this information.
 » 4 weeks ago, # |   +5 KACTL for life!
•  » » 4 weeks ago, # ^ |   0 Damn, thanks! It looks pretty solid