Question
Im Writing a generic skip list in java and I call this function int the class Node /* An O(1) method that returns a reference
Im Writing a generic skip list in java
and I call this function int the class Node
/* An O(1) method that returns a reference to the next node in the skip list at this particular levels. Levels are numbered 0 through (height minus 1), from bottom to top. If levels is less than 0 or greater than (height minus 1), this method should return null. */ public Node
from public class SkipList
like so:
Node
this causes the program to crash declaring "NullPointerException " BUT prints this:
System.out.println(head.next(3));// prints out null
no problemo
Whys it not working? and how do I fix it?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started