Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Written by Prashant Basnet
<section class="bg-white dark:bg-gray-900 px-4 py-8 max-w-2xl mx-auto text-gray-800 dark:text-gray-200">
<h1 class="text-2xl sm:text-3xl font-signature italic font-semibold text-center mb-4">
๐ Welcome โ Youโve Landed on My Signature Page
</h1>
<p class="text-base sm:text-lg mb-4">
Hey, Iโm <strong class="text-black dark:text-white">Prashant Basnet</strong> โ software developmemt engineer at
<a href="https://unisala.com" class="text-indigo-600 dark:text-indigo-400 underline hover:no-underline" target="_blank" rel="noopener noreferrer">
Unisala.com
</a>.
</p>
<p class="text-base sm:text-lg mb-6">
Youโre viewing my <strong>Signature</strong>, a digital space where I share what Iโm learning, building, and reflecting on, all in one place.
</p>
<div class="border-l-4 border-indigo-400 dark:border-indigo-500 pl-4 italic mb-6 text-sm sm:text-base text-gray-700 dark:text-gray-400">
๐ Found this page via LinkedIn, my personal site, or a shared link?
<br />
This isnโt a traditional portfolio. Itโs my public digital notebook where I document useful ideas, experiments, and lessons Iโve learned as I build.
</div>
<h2 class="text-lg font-semibold mb-2">What Youโll Find Here:</h2>
<ul class="list-disc list-inside space-y-1 text-sm sm:text-base">
<li>โ๏ธ Thoughts on algorithms, systems, and software design</li>
<li>๐ง Insights from building at Unisala</li>
<li>๐ Direct links to everything Iโve published on Unisala</li>
</ul>
</section>
A sort that return a specific order of the vertex of a given a graph as long as the graph satisfies certain condition. This is a simple algorithm to learn.
First thing we need to look at is vertex at Isolation.
Every vertex in isolation has what's known as in-degree factor.
This is the key, graph needs to have edges that are directed in order to have this in degree value.
In degree value:
It's represented as how many connections are coming into this vertex. We want to start with vertex that has 0 because we're looking at a vertex in isolation.
So the easiest way to think about it is how many edges are pointing into this vertex
this is whatever the in-degree value for that vertex will be.
What it is is simply, when you get a graph that's directed, you want to figure out what every vertex's in-degree value is
The way topological sort works is that you can only take a vertex and it's value as long as its in-degree value is 0. But once you take it , then you want to remove it from the graph.
What that will do is, it will reduce the in-degree value of any nodes that it is directing into and then those nodes become open for us to take as a next value.
Topological sort does-not have very set order.
Here, we want to take the initial value of one of the vertex with in-degree of 0
This is one example of the topological order that we can get from that graph.
So when is topological sort not applicable?
There can be no cycle within this graph for us to perform a topological sort
If the graph contains a cycle, then it's impossible for us to get the value
The reason why is we can see this eg:
To figure out whether or not our directed graph is acyclic or a cyclic.
Once we finish our topological sort, if we are able to reach every single vertex, then it's a acyclic graph.
If we are not able to then, there must have been a cycle.
this note was taken from
https://www.udemy.com/
Let's solve a course schedule problem in leetcode that utilizes this Topological Sort
course-schedule/description/
bfs returns us the number of courses we can take: