Skip to main content

[ UVa ] 599 - The Forrest for the Trees

  • Given a forest you are to write a program that counts the number of trees and acorns.
  • কোন একটা গ্রাফে Number of Connected Component = মোট Edge সংখ্যা - মোট ভারটেক্স সংখ্যা । 
  • আমরা যদি Adjacent List বানায় তবে যে Node এর Adjacent List এর সাইজ শূন্য সেটা একটা Acorns. 
  • আর সাইজ শূন্য থেকে বড় হলে সেটা একটা ট্রি । 
কোড :

হ্যাপি কোডিং ;)

Comments

Popular posts from this blog