Day 6 was all about leverage and balance.
I have some leave balance (6 days)
So, I decided to take a 0.5 Day Leave.
And don’t worry, I did not sleep! :))
Quick summary: I wrote two technical articles (submitted to publications, fingers crossed), set up my Twitter account to start distributing this journey, and finally tackled Directed Acyclic Graphs (DAGs).
The Graph Grind: Topological Sort
I moved from Trees to Graphs today. Specifically, the “dependency resolution” problem.
Like, If Task B depends on Task A, you must finish A first. This is Topological Sort.
I implemented it two ways to ensure I actually understood it, not just memorized it.
1. The DFS Approach (The Stack)
- Logic: Go deep. When a node has no unvisited neighbors (it’s a “dead end”), push it onto a stack.
- Why it works: The “dead end” is the last task in the chain. By popping the stack at the end, you get the order reversed (First task first).
- Code Feel: Recursive and clean.
2. Kahn’s Algorithm (The BFS Approach)
- Logic: Calculate the Indegree (number of incoming edges) for every node.
- Queue: Put all nodes with
Indegree == 0(no dependencies) into a Queue. - Process: Pop a node, “remove” its edges (decrement neighbor indegrees). If a neighbor hits 0, add it to the queue.
- Why I like it: It detects Cycles automatically! If you can’t process all nodes, there’s a cycle.
From tomorrow onwards, I’ll start solving questions using these.
I finally wrote the 2 technical articles I had in mind.
I also created a Twitter account. It’s empty right now, but the goal is to start cross-posting these logs.
Medium is for the deep dive.
Twitter is for the “Build in Public” community.
The Life Log
- Social: Talked to parents. It’s grounding.
- Health: Short 20-minute walk.
- Energy: High. Taking that half-day was the best decision of the week. I’m entering the weekend with momentum, not exhaustion.
Mood: LFG!!!