codesONLY / JavaScriptONLY

Knowledge Resource of core fundamentals of JavaScript explained in simple way!
382 stars 181 forks source link

Lowest Common Ancestor of a Binary Search Tree.js #75

Closed DEV-AB-03 closed 2 years ago

DEV-AB-03 commented 2 years ago

Here I have proposed the solution for one of the most famous interview questions asked in the "FAANG" companies in Binary Trees Data Structure which is to find the Lowest Common Ancestor of a Nodes in a BST. Here I have used "DFS" traversal technique to find the Common Parent of the given Nodes by checking whether their Child Nodes are equal to the Nodes given and if so then return that Node and if not then traverse left and right sub trees.

sohamsshah commented 2 years ago

Please rename the file in camelCase form. Also, in other files, if they arent in proper naming convention; please change it.

sohamsshah commented 2 years ago

Thanks!

DEV-AB-03 commented 2 years ago

Your Welcome!