Amazon Interview Question for Software Engineer / Developers






Comment hidden because of low score. Click to expand.
0
of 0 vote

Is it that it extends vector, so methods from vector might be misused to disturb the stack ?

- Kx June 23, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Exactly. From this URL (http://www.cs.colostate.edu/~rta/publications/Computer00.pdf), we have:

Class java.util.Stack is a subclass of
java.util.Vector. Stack defines common stack methods
such as push(), pop(), and peek(). However, because
Stack is a subclass of Vector, it inherits all the methods
Vector defines. Thus, you can supply a Stack
object wherever the program specifies a Vector object.
A program can insert or delete elements at specified
locations in a Stack object using Vector’s insert-
ElementAt or removeElementAt methods. It can even
use Vector’s removeElement method to remove a specified
element from a Stack object without regard to
the element’s position in the stack.

- Anonymous July 14, 2008 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

very nice....!!!!

- master January 02, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

is it that it causes stack overflow error??

- swats June 26, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

No, Stack Overflow does not have any concern with this.
That is related to JVM memory.

- ritesh July 03, 2009 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

swats: kick your ass off
first use google to do your home work then put your thoughts out here

- dPac September 25, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Java stack is not a proper implementation of actual Stack data structure. A pure stack should allow only push pop and peek. Java stack allows more..

- sk January 14, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

One more flaw is since Stack uses Vector (which in turn use the Array for its implementation) there is no flexibility for using linked list for Stack.

- lohith December 27, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

hahahaha gud one

- running July 27, 2011 | Flag


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More