20.11.25
18.11.25
28. BST Traversals The One Where We Explore the Tree in Every Possible Direction
hello everyone
So after we finished building the Binary Search Tree, Aarav confidently said,
“Traversal? Easy. It’s just printing stuff.” Rahul looked at him like he just failed recursion 101 and replied, “Bro… there are THREE types of tree traversals. THREE. Try not to break the tree.” And that’s how today’s adventure of Preorder, Inorder, and Postorder began.
What’s Happening Here?
We’re still working with the same BST, but now we’re exploring it in different ways:
Preorder (Root - Left - Right)
Rahul took this one because he likes being first everywhere . He literally starts by printing the node itself before checking anything else like entering a room and announcing, “Rahul has arrived!”
Inorder (Left - Root - Right)
Aarav said this one is “the most peaceful” because it gives sorted output. He liked it because he doesn’t need to think, just go left then root then right. Simple enough for him .
Postorder (Left - Right - Root)
I (Daksh) handled this one. Why? Because I always clean up last and Postorder prints the node at the end. Left subtree, right subtree, and THEN the node. Perfect for someone who finishes everything “later” .
How We Divided the Work
Rahul: Did Preorder instantly
“ROOT first, everything else later. Just like my priorities.”
Aarav: Showed off Inorder
“Sorted output, thank you very much.”
Me (Daksh): Printed Postorder
“This feels like rewriting an exam last minute.
Code:
| ← Previous | 🏠 Homepage |
27. Binary Search Tree (BST) The One Where Rahul Thinks Trees Can Sort Themselves
hello everyone
Today’s coding session started with Rahul saying, “Bro, why do we even need sorting? The tree will do it for us.” Aarav rolled his eyes so hard he almost saw his brain. And I (Daksh)… well, I just quietly opened my laptop because I knew drama + data structures = perfect blog material. And that’s how we ended up learning Binary Search Trees.
What’s Going On Here?
A Binary Search Tree (BST) is that one organized friend who keeps everything in the right place.
Every node follows 3 golden rules:
-
Left child has smaller value
-
Right child has larger value
-
And the tree stays sorted just by inserting things properly
Rahul kept saying, “Bro this is magical, it’s sorting itself!” Aarav corrected him: “No Rahul… YOU are sorting it by inserting it correctly.” Rahul didn’t listen.
How It Works
Insert Operation Rahul Style
Rahul was in charge of insertion.
Every time a number came in, he’d decide:
-
“Small? Go left.”
-
“Big? Go right.”
-
“Equal? Also right. No arguments.”
He behaved like the bouncer outside a club, sending numbers left or right without hesitation. Inorder Traversal Aarav’s Favorite Moment Aarav proudly explained: “Inorder traversal (Left - Root - Right) gives sorted output. Because nature likes order. And Rahul doesn’t.” And that’s exactly what happened the moment we printed inorder traversal, the numbers appeared perfectly sorted. Rahul gasped like he saw a ghost. I (Daksh) Just Observed Everything I kept printing messages like: “Here’s your BST, sorted and peaceful unlike our group WhatsApp chat.” Honestly, the tree handled order better than we ever will.
Code:
| ← Previous | 🏠 Homepage | Next Chapter → |
26. Priority Queue Using Linked List The One Where Friends Let “Priority Decide Everything”
hello everyone
So today’s coding session wasn’t normal because Aarav wanted everything to be first, Rahul wanted only high-priority items, and I (Daksh) just watched them fight while writing the program And that’s exactly how we ended up learning Priority Queue using Linked List.
What’s Going On Here?
A Priority Queue is like real life the most important (or smallest numbered priority) thing gets done first. Not like Aarav, who thinks he should always go first even when his priority is 100 .
We use a linked list so that:
-
each node stores a value and its priority,
-
new elements are inserted in sorted priority order,
-
deletion always removes the highest priority element,
-
and the list grows easily using
malloc.
How It Works
Rahul took over insertions he made sure every new element was placed exactly at the right priority spot, and honestly he was too strict about it “Low priority? Back of the line!” he kept saying. Aarav handled deletions and of course, he only removed the one with the highest priority, bragging every time he “deleted responsibly” I (Daksh) kept displaying the queue after each operation, like: “Here’s your Priority Queue, sorted and drama-free unlike our group decisions.” With all three of us, the priority queue behaved perfectly more perfectly than our plans ever do
Code:
| ← Previous | 🏠 Homepage | Next Chapter → |
rating System
A Friendship Story of Learning Data Structures with C
Sr. No. DSU BLOGS CHAPTERS 1 Array Operations in C, The Group of Friendship (Create, Insert, Delete ...
-
🌟 CHAPTER INDEX: LEARN 'C' (8 Chapters) Chapter Topic Link Page Date Chapter 1 First ...