Cisco Systems Interview Question for Software Engineer / Developers






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

The below function works in a single traversal

struct node* reverse(struct node *temp){
	if(temp!=NULL && temp->next!=NULL){
		struct node *t=reverse(temp->next);
		temp->next->next=temp;
		temp->next=NULL;
		return t;
	}
	else
		return temp;
}

- Hawk May 18, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Good one!!!

- anonymous June 14, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

nice

- Anonymous October 23, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Awesome..! short and effective by using recursion ...

There are three way to reverse LinkList:
1)Traverse list and store nodes in stack then pop up one by one.
2)Use two pointer one (p) at beginning and one (q) at last now start interchanging with p++ and q--.
3)recursion.

- Praveen Tripathi November 07, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

it will blow the stack using recursion on a large list. it needs to be iterative

- Anonymous September 16, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

pos = list->head;
t = getfromtail(list);
while( t!= NULL ;)
{
if (pos = head )
{
// adding before head for the first time
t->next = head;
head = t;
pos = t;
next = pos->next;
}

else {
//Adding after pos
pos->next = t;
t->next = next;
pos = t;
}
t = getfromtail(list);

}

- Anonymous November 18, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

struct node* reverse(struct node *temp){ if(temp!=NULL && temp->next!=NULL){ struct node *t=reverse(temp->next); temp->next->next=temp; temp->next=NULL; return t; } else return temp;}

- Anonymous October 24, 2012 | 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