Member Avatar for kubiak
kubiak

Hi, I have some problem i must to do some homework for our subject called object modeling in java.

Award: Add code to the List class. Inserted numbers should be in two way linked lists stored in ascending order sorted, duplicate values are allowed (re-inserting the same value of nothing), attempts to remove non-existent values are ignored.

NOde must containt some number.
--------------------------------------------
method add--> insert a Node(object) in queue
method containts--> containing the node(object) in queue
method remove --> remove the node from queue
------------------------------------------------
Can someone explain me how work that two way link? add comment, give some solutions, thanks for adding:)
-------------------------------------------------
Code in java:

package homework;

class Node {
Node previous, next;
int contents;
}

class List {
Node first;

void add(int num) { /* code */ }
void remove(int num) { /* code */ }
boolean contains(int num) { /* code */ }
}

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.