Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

LinkedList insert, remove and change  RSS feed

 
Alexie Chong
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Experts,

I am new to the LinkedList concept and trying out coding a LinkedList problem which require me to do Insert newInteger based on the Index, Remove Index and Change oldInteger to newInteger based on Index.
Please kindly advice what i should code in my

------------------------------------------------------------------------------------
Sample input

4 8
1 5 2 3
4
I 1 2
R 2
C 1 10
I 4 2

Sample output

YES
NO
NO
NO
------------------------------------------------------------------------------------

Here is my full code:

 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16007
87
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Before writing any code, you need to understand what a linked list is and how it works, and what your three methods are supposed to do exactly. Once you understand exactly what needs to be done, you can start thinking about writing code.

So, do you understand how a linked list works? If not, then what about it don't you understand exactly?

Can you describe in English what you think should be done in the insert, remove and change methods?
 
Campbell Ritchie
Sheriff
Posts: 55329
157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And you need to check about equality. Don't use == for reference types (unless they are enum members), but at least the compiler will notice you are using = by mistake.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!