Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-01-2008, 05:29 PM
Member
 
Join Date: May 2008
Posts: 12
ayoood is on a distinguished road
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.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 05-01-2008, 05:31 PM
Member
 
Join Date: Apr 2008
Posts: 19
theonly is on a distinguished road
Well, it's hard to do any of that without being in your class?
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 05-01-2008, 05:43 PM
sukatoa's Avatar
Senior Member
 
Join Date: Jan 2008
Location: Cebu City, Philippines
Posts: 309
sukatoa is on a distinguished road
Send a message via Yahoo to sukatoa
Ofcourse...

Quote:
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.
Try to attempt an effort..... There are experts here that are ready to help you out....(problem about your code.)
__________________
best regards,
sukatoa

Last edited by sukatoa : 05-01-2008 at 05:45 PM.
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 05-01-2008, 06:34 PM
Member
 
Join Date: May 2008
Posts: 12
ayoood is on a distinguished road
its an assignment if you need to attemt the lecture i will
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 05-01-2008, 06:35 PM
Member
 
Join Date: May 2008
Posts: 12
ayoood is on a distinguished road
http://www.nmehic.com/csci260/Lectur...Final%20SQ.ppt

this is the lecture

think you again for your help
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 05-01-2008, 06:58 PM
Member
 
Join Date: Apr 2008
Posts: 19
theonly is on a distinguished road
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.
Bookmark Post in Technorati
Reply With Quote
  #7 (permalink)  
Old 05-09-2008, 10:44 AM
Member
 
Join Date: May 2008
Posts: 12
ayoood is on a distinguished road
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);
}

}
Bookmark Post in Technorati
Reply With Quote
  #8 (permalink)  
Old 05-09-2008, 11:14 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 1,264
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Lots of errors I can found there pal. Here what you have to do.

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); } }
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
Want to make your IDE the best?Vote Now
Bookmark Post in Technorati
Reply With Quote
  #9 (permalink)  
Old 05-09-2008, 11:18 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 1,264
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Still you have lots of things to learn there.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
Want to make your IDE the best?Vote Now
Bookmark Post in Technorati
Reply With Quote
  #10 (permalink)  
Old 05-09-2008, 11:44 AM
Member
 
Join Date: May 2008
Posts: 12
ayoood is on a distinguished road
thank you very much for your help
Bookmark Post in Technorati
Reply With Quote
  #11 (permalink)  
Old 05-10-2008, 11:16 AM
Member
 
Join Date: May 2008
Posts: 1
tito84 is on a distinguished road
Quote:
Originally Posted by Eranga View Post
Lots of errors I can found there pal. Here what you have to do.

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); } }


how does this programme work

can you tell me each code how work plz
Bookmark Post in Technorati
Reply With Quote
  #12 (permalink)  
Old 05-10-2008, 12:02 PM
Member
 
Join Date: May 2008
Posts: 12
ayoood is on a distinguished road
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 11:03 AM.
Bookmark Post in Technorati
Reply With Quote
  #13 (permalink)  
Old 05-12-2008, 04:44 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 1,264
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Quote:
Originally Posted by tito84 View Post
how does this programme work

can you tell me each code how work plz
First LinkedList is declared and initialized.

Code:
LinkedList <Integer> list = new LinkedList<Integer>();
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.

Just add elements there.

Code:
list.add(new Integer(1));
Here actually no need to instantiate a int value. Simply add.

Code:
list.add(1);
Or you can define the index that where you want to add the element.

Code:
list.add(2, new Integer(0));
But you can't skip index there. Then remove element,

Code:
list.remove(0);
Remove the 0th element of the list.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
Want to make your IDE the best?Vote Now

Last edited by Eranga : 05-12-2008 at 04:48 AM.
Bookmark Post in Technorati
Reply With Quote
  #14 (permalink)  
Old 05-12-2008, 04:47 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 1,264
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Quote:
Originally Posted by ayoood View Post
could you change the name of programme to generic plz
I don't know what you are trying to do. See that your class declaration also incorrect. And defining generics for LinkedList too.

It's much better to do some work with basis of Java, then try some applications like this.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
Want to make your IDE the best?Vote Now
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +3. The time now is 11:02 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org