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.

有帮助吗?

解决方案

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. ;)

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top