ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Обсуждение задачи 1982. План электрификации

What is my code doing?
Послано Nithin 16 май 2017 22:38
I have implemented a greedy algorithm to solve this problem and it got accepted and after reading the discussion I have noticed that many people used Prims algorithm to solve.
I have no idea of what Prims algorithm is. Could anyone please tell me what exactly is my code doing and how is it different from Prims algorithm?

[code deleted]

Edited by moderator 21.01.2020 16:06
Re: What is my code doing?
Послано Mahilewets 17 май 2017 20:12
There are only three algorithms for finding minimal spanning.  Their complexities are different,  but idea is the same.  So,  we can say that they all are actually the same algorithm.  Your code is most similar to Kruskal's algo.
You arr finding the smallest edge and adding it to MST.