Mindtree Wireless India Interview Question for Software Engineer / Developers






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

for this we should have the last pointer as well which point to the last node in the list.

- DashDash September 28, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

how about circular list?

- Arang September 29, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Not just circular, but doubly-linked circular list. This way we don't have to maintain a tail pointer

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

But with the first and last pointers, v can perform insertions @ both ends in O(1) time. If no last ptr is used, i think it takes O(n) time to insert at the end.(i.e to traverse the n nodes to reach to the last node).

- Anu December 12, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

for insert at begnning
insert_beg(struct node **q,int a)
{
struct node *temp;
temp=(struct node*)malloc(sizeof(struct node));
temp->data=a;
temp->next=*q;
*q=temp;
}

and insert at end is

insert_end(struct node **q,int a)
{
struct node *temp,r;
temp=*q;
while(temp->next!=NULL)
temp=temp>next;
r=malloc(sizeof(struct node));
r->data=a;
r->next=NULL:
temp->next=r;
}

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

place of r use *r

- Anonymous April 27, 2011 | 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