# Graph Theory: Find cycles

Tags: , | Posted by Admin on 1/18/2012 11:34 AM | Comments (0)
Given an undirected graph, design a O(V+E) algo to detect whether there is a triangle in the graph ot not.

# How to find the Least Common Ancestor for 2 nodes of a binary tree ?

Tags: , | Posted by Admin on 1/16/2012 5:32 PM | Comments (0)
Question: How to find the Least Common Ancestor for 2 nodes of a binary tree? This sounds like "On finding lowest common ancestors: simplification and parallelization", by Baruch Schieber and Uzi Vishkin, SIAM J. Comput. Vol 17, No 6, December 1988. A google search leads me tohttp://ia700208.us.archive.org/12/items/onfindinglowe00schi/onfindin... [More]

# Find the Closest intersection point in plan

Tags: , | Posted by Admin on 1/12/2012 12:45 PM | Comments (0)
Jim was asked following question in interview recently: Let suppose you have, following grid on Cartesian coordinate system ( Quadrant I). o - x - x - x - o | | | | | x - x - x - o - x | | | | | x - o - o - x - x where, o => person at intersection and x => no person at intersection class Point { int x; int y; boolean h... [More]