#Can anyone Help me with the error on my program Skipped List Doubly Linked List
1 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @worldly glen! Please use
/closeor theClose Postbutton above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
Looks like you shared a lot of code, this may cause people to overlook problems in your code. To make it easier for them, make sure you only share lines that are relevant to your issue.
And it would be great if you specify your problem and not just paste the entire class without comment.
as of now. i'm struggling for this error
You have another variable "list" defined in the scope. Rename one of them.
I tried it but nothing happen
Then you have other errors hindering compilation. What other errors does the ide show ?
I tried to change a little and it goes fine without errors in lines but when runtime. the error appear
As I said please only share the relevant part of you code formatted correctly
Please format your code & make it more readable.
For the java programming language, it should look like this:
```java
public class Main{
public static void main(String[] args){
System.out.println("Hello World!");
}
}```
• These are backticks, not quotes.
Enter the initial size of the doubly linked list: 3
Enter the elements of the doubly linked list in ascending order:
123
124
125
Exception in thread "main" java.lang.NegativeArraySizeException: -2147483648
at SkippedList.SkipList.<init>(SkipList.java:39)
at SkippedList.SkipList$DoublyLinkedList$Main.main(SkipList.java:228)
Whats line 39 in SkipList and whats line 228 in DoubleLinkedList
that's it
The user will input the initial size and elements of the doubly linked list. Only integer
values are valid elements. After the input, all elements must be sorted in ascending order. This
operation must be performed before other operations. This operation can only be performed once.
after I input the integer value. it error during runtime
Check what the value of skipSize and levels are in line 39
The value of the two variables I just listed.
okay gets. there's no value stored in the variable level and skipList
it is needed to inputted by the user
In line 39 they better have a value. Whats the value both variables have in line 39. Use a debugger to find out
What IDE are you using ?
VS Code