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. আর সাইজ শূন্য থেকে বড় হলে সেটা একটা ট্রি । কোড : হ্যাপি কোডিং ;)
If you only do what you can do you will never become more than you are now ___Master Shifu
Comments
Post a Comment