Pergunta

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.

Foi útil?

Solução

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

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top