Queries on Tree : Course (CodeNCode) (8 Aug 2020 : 2 new centroid decomposition lecture added)

can someone tell for GOT problem how to take input in JAVA like its end on EOF

Scanner s = new Scanner(System.in);
while (s.hasNextInt()) {
    A[i] = s.nextInt();
    i++;
}

for more info refer this : file io - reading input till EOF in java - Stack Overflow

Bro can u please make video on TREDIFF problem of May Lunchtime 2020 of division 2.

I didn’t participate in that contest , is it a Mo’s problem?

It was basically an LCA problem. The time limit was too tight for MO’s.

Here is my solution using MO’s which passed in 1.92 sec :zipper_mouth_face: - SOLUTION USING MO’s

1 Like

@waqar_ahmad224 Bro , Thanks a lot for this course :slight_smile: . Also , can you or someone please list out what other different kinds of problems can be solved using euler tour technique ?

may be this problem : CodeChef: Practical coding for everyone

and do checkout this blog by anudeep : https://blog.anudeep2011.com/mos-algorithm/

contains more practice problems

Thanks for u r help :raised_hands:

Please Upload lecture on HLD…Really Needed :frowning:

sir how to I know many of the topics but I still fail in the contests.I am hardly able to solve three problems on codechef long challenge and 2 problems on codeforces.sir please help thanks.

next concept is I will be teaching is re rooting technique , then Centroid decomposition and then HLD

2 Likes

this is because you hardly practice (by analyzing your codechef profile).
on codechef you have solved (fully) 26 problems from November 2019.
so in last 7 months you have solved only 26 problems.

just knowing an algorithm wouldn’t guarantee that you will be able to solve a problem related to that concept , you need to practice.

I have solved roughly 1500 problems across platform so just imagine how much important practice must be.

give more time to practice , as much as you can.

try solving greedy (from 1300 rating to 1500 rating) and constructing algorithm problems(from 1300 rating to 1500 rating) from codeforces.

keep practicing and you will surely gain confidence and experience

Thankyou sir,I am in 4th semester ,How much problems from each algorithm should I practice.How should I practice so that I can also be yellow or purple on codeforces in 3 months or so.

I saw your profile.Your ratings were low in some starting contests after this it started increasing.How did you practice to be better and better at cp

i am in grade 11…just started Python in May…even i want to have a good ranking

Excited about your videos.
Upload soon. Thank you.

hard to define an exact number.
reason to practice problem of a specific algorithm is to learn how the same algorithm can be used to solve different kind of problems , so main focus of practice should be to cover as many variation of problems which can be solved using an algorithm as possible.

but for each algorithm try solving at least 5 easy , 4 to 5 medium and at least 5 hard problems.

believe me medium and hard problems teach much more than easy.

so depending upon your comfort level try solving at least 10 medium + hard problems for an algorithm

Flat Tree is binary tree?
Mo’s algorithm used for binary tree?

no flat tree is basically an array (nodes appear in order of dfs run).
I have explained that in some lecture i guess.

and Mo’s algorithm that we studied is used for general tree not only for binary tree.

Can anyone please help me with this problem

This is my code

Sample test cases are passing but i am getting TLE for submission…