Printing Segtree for debugging purposes

Revision en2, by vrooooom, 2020-08-04 22:45:01

Hey there, :)

Normally whenever I am working on a task requiring a segment tree or some similar data structure problem, and my code does not work, I find myself at a loss for what to do because it seems kind of hard to tell whether or not the segment tree is working properly or not...

I wrote this quick function to print a somewhat simple segment tree, but it feels rather ugly, and I don't think it would be feasible for more complex data structures.

Print_seg function

Do you have any functions/scripts that you use to debug data structure problems, and if so, I would appreciate it if you would share it in the comments :p

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English vrooooom 2020-08-04 22:45:01 87 Tiny change: ' 14...\n for(in' -> ' 14...\n cout << "Printing seg tree " << endl;\n for(in' (published)
en1 English vrooooom 2020-08-04 22:40:20 988 Initial revision (saved to drafts)