Microsoft Interview Question: insert an element at the end ... | Glassdoor

Interview Question

Software Development Engineer II Interview Redmond, WA

insert an element at the end of a circular linked list in

  which you have just the pointer to the head
Answer

Interview Answer

1 Answer

0

Node insertCircularEnd(Node head, int data){

if(head == null) return null;

Node n = new Node();
n.data = head.data;
head.data = data;
n.next = head.next;
head.next = n;

return head;
}

Anonymous on Feb 12, 2016

Add Answers or Comments

To comment on this, Sign In or Sign Up.