当我尝试阅读 0.6 时,我得到了 java.util.InputMismatchException 这是代码的一部分。如您所见,我尝试为练习表重新实现 SkipList。
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
double f = scan.nextDouble();
impl_with_errors list = new impl_with_errors(f);
int n = scan.nextInt();
public class impl_with_errors {
public static double chance;
public Node list0;
public Node list1;
public Node list2;
public Node list3;
/**
* the constructor of the skiplist
* @param p the chance that an element shall be in a higher list
*/
public impl_with_errors(double p) {
chance = p;
list0 = null;
list1 = null;
list2 = null;
list3 = null;
}