Amazon Interview Question for Software Engineer / Developers






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

No one has considered the case when the node to delete is node where there exist cycle.

- M August 16, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

e.g. a->b->c->b
deleting b is tricky

- M August 16, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Not think so.
In your case,if double linkedlist,the previous node of b is not determined,a or c. If single,yes,it's tricky,but deleting b,means deleting the cycle b,c,which is not only deleting one node.

- Anonymous February 01, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Use the rear pointer and handle it similar to a normal linked list

- Way out November 12, 2007 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Can you please give the code for this?

- Java Coder November 26, 2007 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

copy over the rear node, and delete the rear node

- Anonymous September 11, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

void delete(cnode** node){
cnode* temp = (cnode*)malloc(sizeof(cnode));
if(temp==NULL)
return;
temp = node->next ;
node->val = node->next->val ;
node->next = node->next->next;
node->next->next->prev= node;
free(temp);
}

- deaGle October 31, 2008 | Flag Reply


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