MCPcopy Create free account
hub / github.com/careercup/ctci / deleteNode

Method deleteNode

java/Chapter 2/Question2_3/Question.java:8–16  ·  view source on GitHub ↗
(LinkedListNode n)

Source from the content-addressed store, hash-verified

6public class Question {
7
8 public static boolean deleteNode(LinkedListNode n) {
9 if (n == null || n.next == null) {
10 return false; // Failure
11 }
12 LinkedListNode next = n.next;
13 n.data = next.data;
14 n.next = next.next;
15 return true;
16 }
17
18 public static void main(String[] args) {
19 LinkedListNode head = AssortedMethods.randomLinkedList(10, 0, 10);

Callers 2

mainMethod · 0.95
2_3_Spec.jsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected