|
|
вернуться в форумОбщий форумis my algorithm right? problem 1022 i'm using method of giving points to each person, so that every child has more points than his father. i'm doing that with bfs: if points[child] <= points[parent] points[child] = points[parent] + 1; bfs (child); i think method is right. i know about topological sort, but i'm interested is my idea ok. (my code fails on test case #5). Re: is my algorithm right? problem 1022 Try my algorithm: You find the person at which there are no parents. Remove him. You delete him. And all this in a cycle. Re: is my algorithm right? problem 1022 i know about that. that's topological sort. i'm only trying to figure out if my algorithm is correct. that's all. :) :( If at you wa5 as your algorithm can be correct.:) I simply wanted to help. Re: :) :( i don't understand your post. also, i haven't got any comment about my problem yet. |
|
|