algorithm for RIGHTRI problem

I wanna know how to solve this problem. If it is graph related solving problem, i am new to solving graph problems so recommend some algorithms and books to refer. A brief explanation would be appreciated.

you just need to check for every set of points if they form a right triangle. Nothing special is needed.

Hi arvindkr,

firstly don’t confuse with graph. this is simple problem you have given three points in 2D plane and asked to check weather they form right angled triangle or not

so you can simply apply distance formula ( of straight line chapter) between two points to find distance and then check condition for right angled triangle (Pythagoras’ theorem c^2 = a^2 + b^2 )

sometimes graph related problem can also be solved using simple array ,string concept hence don’t give up if you dont know that algo then just try solving in your own way who knows you may succeed.
for learning algo and DS just keep watching this link https://discuss.codechef.com/questions/48877/data-structures-and-algorithms it include lots of ds ,algo implimentation and related problem but firstly complete beginner practice section then go for easy section and so on with ds ,algo. for reference online sources are enough sites and blog etc. if you want books then go for bible i.e CLRS

1 Like
//