octane.power
BAN USER- 2 Answers common ansestor
I have the book Cracking the Coding Interview Fourth eddition. I have a question about the solution to problem 4.6 (Find first common ansestor of two nodes in a binary tree). The solution ends up suggesting some round about way to see if both nodes are on the same side of a given node and what not. It's pretty confusing. But why not just do a depth first search for each of the nodes. Once node is found, record the path back to the root as the recurstion stack unwids. What's the advantage of the complicatd solution offered by your book over this?
- octane.power December 09, 2012| Flag | PURGE
Repjolenejbrunson0456, Applications Developer at Abs india pvt. ltd.
Hey I am a web writer, also known as a content writer, is a type of writer that produces content ...
Repseffreyclifford, Area Sales Manager at Achieve Internet
I am a self-motivated office administrator. I am responsible for providing administrative support to office personnel. I have excellent written ...
RepAdyaKing, Java Experienced at ADP
I am a friendly and outgoing person who enjoys greeting people with a smile. I have more than 5 years ...
RepCliftonMalone, Android Engineer at ABC TECH SUPPORT
Hello, I am a Seo Analyst with 5 years of experience in helping large ecommerce websites reach higher organic positions ...
RepAadenGarcia, Analyst at ADP
I have a knowledgeable professional librarian with more than 4 years of experience in the public library setting. I have ...
Repjaksanjak17, Sports official at Avant Garde Appraisal Group
I am a Sports official in Avant Garde Appraisal Group . in a variety of sports and competition, responsible for enforcing ...
Repsylviatobins, Applications Developer at 247quickbookshelp
Hi, I am Sylvia Law librarian. I am an information resource expert. I work in law schools, corporate law departments ...