New posts

This commit is contained in:
2026-11-06 21:43:33 +05:30
parent 8d8d7956ba
commit 4a9021d936
34 changed files with 1778 additions and 0 deletions
@@ -0,0 +1,19 @@
JVM: Eclipse Adoptium 25.0.5, ThreadStackSize=4096 KB, cores=2
Built a left-skewed tree with 1000000 nodes using a loop (no recursion).
Depth reached by a recursive probe before StackOverflowError (3 attempts in one JVM):
attempt 1: StackOverflowError after reaching depth 51051
attempt 2: StackOverflowError after reaching depth 127818
attempt 3: StackOverflowError after reaching depth 127818
RecursiveTraversals.inorder on the same tree:
caught java.lang.StackOverflowError
stack trace length: 1024 frames (the JVM truncates traces; the real depth is larger)
at com.ankurm.interviewlab.bintree.RecursiveTraversals.inorder(RecursiveTraversals.java:20)
at com.ankurm.interviewlab.bintree.RecursiveTraversals.inorder(RecursiveTraversals.java:20)
at com.ankurm.interviewlab.bintree.RecursiveTraversals.inorder(RecursiveTraversals.java:20)
at com.ankurm.interviewlab.bintree.RecursiveTraversals.inorder(RecursiveTraversals.java:20)
...
IterativeTraversals.inorder on the same tree:
visited 1000000 nodes, first=1000000, last=1, no error