-1

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.

  • 1
    *"I am trying to learn on my own."* You won't learn on your own if we just hand you the code. – Bucket Apr 17 '14 at 19:45
  • I am not even asking for a code I would just like a small pseudo code or even just main // code here function //stuff it does here or something like it. I have hard to time starting from scratch I have felt if I see something like a template or know which function to code it makes it easier for me to code. – user3362962 Apr 17 '14 at 19:59
  • Javascript can be run from a console. There is no `main` method like in Java or C. If you open Chrome Developer Tools or Firebug (either can be opened with F12), you can open a console window and run scripts from there. – Bucket Apr 17 '14 at 20:05
  • Okay thanks I will try it out and see what happens. Hopefully fail then succeed :) – user3362962 Apr 17 '14 at 20:09

1 Answers1

0

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

Community
  • 1
  • 1
ray
  • 148
  • 3
  • 15