Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is LinkedListNode in Java

Excuse my ignorance but I am beginning to prepare for my first technical interview and came across this question and answer on the topic linkedlist

Question: Implement an algorithm to delete a node in the middle of a single linked list, given only access to that node

public static boolean deleteNode(LinkedListNode n) {
if (n == null || n.next == null) {
   return false; // Failure
}
LinkedListNode next = n.next;
n.data = next.data;
n.next = next.next;
return true;
}

I want to start playing with this code (making changes compile test) but I'm not sure how to start doing this in Java. I cannot find the LinkedListNode class in Java docs.

This might be a very silly question but if someone can point me in the right direction - will appreciate it.

EDIT

Thanks for the quick and useful responses. I guess my question was not very clear. The algorithm above was provided as a solution to that question. I wanted to know how to implement that in Java so I can play around with the code.

thanks

like image 335
riamo Avatar asked Mar 21 '11 05:03

riamo


1 Answers

This class is most likely a hypothetical class used for this Linked List example question.

like image 51
MeBigFatGuy Avatar answered Oct 13 '22 16:10

MeBigFatGuy