#Can anyone Help me with the error on my program Skipped List Doubly Linked List

1 messages · Page 1 of 1 (latest)

worldly glen
mental anchorBOT
#

This post has been reserved for your question.

Hey @worldly glen! Please use /close or the Close Post button 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.

mental anchorBOT
#

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.

tough coral
#

And it would be great if you specify your problem and not just paste the entire class without comment.

worldly glen
#

as of now. i'm struggling for this error

tough coral
#

You have another variable "list" defined in the scope. Rename one of them.

worldly glen
tough coral
#

Then you have other errors hindering compilation. What other errors does the ide show ?

worldly glen
#

I tried to change a little and it goes fine without errors in lines but when runtime. the error appear

tough coral
#

As I said please only share the relevant part of you code formatted correctly

mental anchorBOT
#

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.

worldly glen
#

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)

tough coral
#

Whats line 39 in SkipList and whats line 228 in DoubleLinkedList

worldly glen
#

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

tough coral
# worldly glen

Check what the value of skipSize and levels are in line 39

worldly glen
#

what do you mean value??

#

the inputted integer or variable?

tough coral
#

The value of the two variables I just listed.

worldly glen
#

okay gets. there's no value stored in the variable level and skipList

#

it is needed to inputted by the user

tough coral
#

In line 39 they better have a value. Whats the value both variables have in line 39. Use a debugger to find out

worldly glen
#

what debugger you recommend sir?

#

I only use terminal sir

tough coral
#

What IDE are you using ?

worldly glen
tough coral