M

Mr. Dubey • 100.69K Points
Coach

Q. How do you insert a node at the beginning of the list?

  • (A) public class insertfront(int data) { node node = new node(data, head, head.getnext()); node.getnext().setprev(node); head.setnext(node); size++; }
  • (B) public class insertfront(int data) { node node = new node(data, head, head); node.getnext().setprev(node); head.setnext(node); size++; }
  • (C) public class insertfront(int data) { node node = new node(data, head, head.getnext()); node.getnext().setprev(head); head.setnext(node); size++; }
  • (D) public class insertfront(int data) { node node = new node(data, head, head.getnext()); node.getnext().setprev(node); head.setnext(node.getnext()); size++; }
Share

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.


Question analytics