Topological sorting is a linear ordering of vertices in a directed acyclic graph. It is implemented using a decrease and conquer approach where the algorithm identifies a source vertex with no incoming edges, removes it from the graph, and repeats until all vertices are removed, outputting the order of deletions. The example shows the topological sorting of course prerequisites, where the algorithm iteratively deletes courses with all prerequisites completed until all courses are removed in a valid order of C1, C2, C3, C4, C5.