Results 1 to 14 of 14
Thread: i need same of help
- 05-01-2008, 04:29 PM #1
Member
- Join Date
- May 2008
- Posts
- 39
- Rep Power
- 0
i need same of help
Hi every body
How are you??
i need same of help plz
Could anyone solve for me this problem??
thank you for your help :)
Due: May 4, 2008
1. Create your own version of the Java program to implement a linked list as explained in class.
2. Create a Java program for doubly linked lists and provide input and output.
3. Analyze examples with generic classes given in class used in building linked lists. Make your own example.
- 05-01-2008, 04:31 PM #2
Member
- Join Date
- Apr 2008
- Posts
- 23
- Rep Power
- 0
Well, it's hard to do any of that without being in your class? :)
- 05-01-2008, 04:43 PM #3
Ofcourse...
Try to attempt an effort..... There are experts here that are ready to help you out....(problem about your code.)Due: May 4, 2008
1. Create your own version of the Java program to implement a linked list as explained in class.
2. Create a Java program for doubly linked lists and provide input and output.
3. Analyze examples with generic classes given in class used in building linked lists. Make your own example.Last edited by sukatoa; 05-01-2008 at 04:45 PM.
freedom exists in the world of ideas
- 05-01-2008, 05:34 PM #4
Member
- Join Date
- May 2008
- Posts
- 39
- Rep Power
- 0
its an assignment if you need to attemt the lecture i will
- 05-01-2008, 05:35 PM #5
Member
- Join Date
- May 2008
- Posts
- 39
- Rep Power
- 0
http://www.nmehic.com/csci260/Lectur...Final%20SQ.ppt
this is the lecture
think you again for your help
- 05-01-2008, 05:58 PM #6
Member
- Join Date
- Apr 2008
- Posts
- 23
- Rep Power
- 0
Like Sukatoa, said try this yourself, first. I will gladly help you, but give this a honest attempt. Understanding Linked-list is really important if you plan on continuing programming.
- 05-09-2008, 09:44 AM #7
Member
- Join Date
- May 2008
- Posts
- 39
- Rep Power
- 0
this is my code what the wrong with it
public class DoublyLinkedList
{
public static void main(String args[])
{
DoublyLinkedList<Integer> list = new DoublyLinkedListinkedList<Integer>();
list.addHead(new Integer(1));
list.addHead(new Integer(2));
list.addTail(new Integer(9));
list.addHead(new Integer(3));
list.addTail(new Integer(11));
list.add(2, new Integer(0));
System.out.println(list);
list.remove(list.size());
System.out.println(list);
}
}
- 05-09-2008, 10:14 AM #8
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Lots of errors I can found there pal. Here what you have to do.
Java Code:import java.util.LinkedList; public class DoublyLinkedList { public static void main(String[] args) { LinkedList <Integer> list = new LinkedList<Integer>(); list.add(new Integer(1)); list.add(new Integer(2)); list.add(new Integer(9)); list.add(new Integer(3)); list.add(new Integer(11)); list.add(2, new Integer(0)); System.out.println(list); list.remove(0); System.out.println(list); } }
- 05-09-2008, 10:18 AM #9
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Still you have lots of things to learn there.
- 05-09-2008, 10:44 AM #10
Member
- Join Date
- May 2008
- Posts
- 39
- Rep Power
- 0
thank you very much for your help
- 05-10-2008, 10:16 AM #11
Member
- Join Date
- May 2008
- Posts
- 1
- Rep Power
- 0
- 05-10-2008, 11:02 AM #12
Member
- Join Date
- May 2008
- Posts
- 39
- Rep Power
- 0
hi
i have this programme i don’t know why does not work with me
class Queue<T> {
private LinkedList<T> items = new LinkedList<T>();
public void enqueue(T item) {
items.addLast(item);
}
public T dequeue() {
return items.removeFirst();
}
public boolean isEmpty() {
return (items.size() == 0);
}
public void addAll(Collection<? extends T> collection) {
// Add all the items from the collection to the end of the queue
for ( T item : collection )
enqueue(item);
}
}Last edited by ayoood; 05-12-2008 at 10:03 AM.
- 05-12-2008, 03:44 AM #13
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
First LinkedList is declared and initialized.
Here you have to define the generic to avoid compiler warnings. Generic is depend on the LinkedList element type. Here it is an Integer. Then populate the linked list. You can do it in different ways.Java Code:LinkedList <Integer> list = new LinkedList<Integer>();
Just add elements there.
Here actually no need to instantiate a int value. Simply add.Java Code:list.add(new Integer(1));
Or you can define the index that where you want to add the element.Java Code:list.add(1);
But you can't skip index there. Then remove element,Java Code:list.add(2, new Integer(0));
Remove the 0th element of the list.Java Code:list.remove(0);
Last edited by Eranga; 05-12-2008 at 03:48 AM.
- 05-12-2008, 03:47 AM #14
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks