File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

LinkedList insert, remove and change

 
Alexie Chong
Greenhorn
Posts: 3
  • 0
  • 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
Saloon Keeper
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • 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
Pie
Posts: 47229
52
  • 0
  • 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