Archive for Interview

Interview questions

Posted in Algorithm with tags , , , on February 6, 2008 by wsjoung
  • what’s difference C++ and java
  • explain about java static
  • is java use call by reference or call by value
  • get the algorithm to fine nth value from the last element in single linked list, and write code

all questions look pretty easy though,

anyway, the last algorithm question. because it’s just one direction single linked list, we should trouble from the start node to the last node. then we can figure out how many elements in that linked list when we reached the last element. then we can simply travel again from the start node to (m-n)th element. complexity is O(n).
I was trying to bring up some other data structure like stack or hash table but, all those are not good in terms of space efficiency. we do not have to wast precious resource which doesn’t increase the performance that much.