Question

I have to write a program which will find the lowest common ancestors but I have to use stack and queue. I am trying to learn on my own and just solving all the interview questions from the web can anyone help me get started? just need a template and I can fill out the meat of the program.

Was it helpful?

Solution

To implement your stack and queue you can use a simple array. The array object in javascript has commands like push(sth) or pop().

For more informations, take a look @ http://www.w3schools.com/js/js_obj_array.asp

Also check this out: How do you implement a Stack and a Queue in JavaScript?.

I hope you can start from here. learning by doing is the best way to learn sth. ;)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top