[Query] Persistent Segment Tree and Custom Allocators

Revision en23, by presumption, 2024-02-07 11:01:43

I was recently up-solving AtCoder Beginner Contest 339 and came across a Persistent Segment Tree Problem G — Smaller Sum.

While implementing my own Persistent Segment Tree. I tried to make it as generic as possible.

Code:

Here are few things that I want your help and opinion on:

  • Is their a more generic and efficient way to implement Persistent Segment Tree? and How to improve the above code?
  • How can you identify if a problem uses Persistent Segment Tree?
  • Is their a better way to implement custom allocator for Competitive Programming(or for C++/C projects)?
  • How to implement Lazy Persistent Segment Tree?
  • How to add documentation to Personal Library codes?

Upd: I re-wrote the Persistent Segment Tree with documentation and without custom allocator. Thanks to lrvideckis and NimaAryan for help.

Code:
Tags persistent, allocation, c++, persistent segment trees

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en23 English presumption 2024-02-07 11:01:43 32 Tiny change: '24-02-07] for help' -> '24-02-07] and [user:NimaAryan] for help'
en22 English presumption 2024-02-07 11:00:31 0 Tiny change: '*Upd:** I re-wrote t' -> '*Upd:** I **re-wrote t' (published)
en21 English presumption 2024-02-07 10:58:22 6040 (saved to drafts)
en20 English presumption 2024-02-06 19:58:00 0 (published)
en19 English presumption 2024-02-06 19:54:13 125
en18 English presumption 2024-02-06 19:52:14 2 Tiny change: 'sible.\n\n<spoil' -> 'sible.\n\n\n<spoil'
en17 English presumption 2024-02-06 19:50:50 115
en16 English presumption 2024-02-06 19:49:04 8
en15 English presumption 2024-02-06 19:48:21 6 Tiny change: 'pinion on: \n- Is the' -> 'pinion on:\n\n\n- Is the'
en14 English presumption 2024-02-06 19:48:06 2
en13 English presumption 2024-02-06 19:47:04 4 Tiny change: '\n\n\n\n\n' -> '\n\n\n\n\n\n\n'
en12 English presumption 2024-02-06 19:46:50 92
en11 English presumption 2024-02-06 19:46:19 126
en10 English presumption 2024-02-06 19:44:24 89
en9 English presumption 2024-02-06 19:42:58 226
en8 English presumption 2024-02-06 19:37:08 1 Tiny change: 'er>\n\n### Here a' -> 'er>\n\n#### Here a'
en7 English presumption 2024-02-06 19:36:50 213
en6 English presumption 2024-02-06 19:33:28 39
en5 English presumption 2024-02-06 19:32:27 4476
en4 English presumption 2024-02-06 19:29:47 9 Tiny change: 'oblem **[G &mdash; Smaller S' -> 'oblem **[G: Smaller S'
en3 English presumption 2024-02-06 19:29:32 0 Tiny change: 'blem **[G &mdash; Smaller S' -> 'blem **[G - Smaller S'
en2 English presumption 2024-02-06 19:29:20 72
en1 English presumption 2024-02-06 19:28:10 266 Initial revision (saved to drafts)