Topological Sort

Topological Sort

Machine-readable: Markdown · JSON API · Site index

Поделиться Telegram VK Бот
Транскрипт Скачать .md
Анализ с AI

Оглавление (1 сегментов)

Segment 1 (00:00 - 01:00)

now let's solve course schedule we're given a bunch of pairs of courses so for example before we can take course B we have to take course a first and maybe before we can take course C we also have to take course a first but before we can take course D we have to take C and we have to take B is it possible for us to take every single course in this example it is we first start out with course a but after a we can then take either this one or this one and then after we take both of them we can then take d add a line from D back to a it is now no longer possible so this problem is all about cycle detection is just building an adjacency list we're given the edges and we want to convert it into a graph then after that we're going to initialize a q for our breath for search we're only going to add the nodes that don't have any prerequisites after that we do a basic bread for search down here

Другие видео автора — NeetCode

Ctrl+V

Экстракт Знаний в Telegram

Экстракты и дистилляты из лучших YouTube-каналов — сразу после публикации.

Подписаться

Дайджест Экстрактов

Лучшие методички за неделю — каждый понедельник