• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 129
  • Last Modified:

linkedlist related questions


LinkedList l=new LinkedList (Colletion c);

above linked list constructor takes any kind of collection object including map, queue, stack as argument?

How array based queue and stack is different from   linked list  based queue and stack? Any sample example on each kind

what are advantages disadvantages of linked list with respect to insertion, deletion, retrieval.

what are advantages disadvantages arraylist, linkedlist and when to use each one.

How is retrieval from Collection object different from deletion. please advise
  • 2
1 Solution
You can only get so far by asking widely generic questions on websites like this in my opinion. There is nothing to stop you reading the Java vendor's webpages on all the API subjects you want to learn, or indeed the dozens of expert books that are online and in bookshops. But by asking us to reproduce what is already in all these sources in a more readily-digestible and unambiguous way than they already are, is a task that isn't going to help you and that few people will want to spend their time on.

Make your questions more precise, as and when you have a problem with your code, and you are likely to get a better response.
gudii9Author Commented:
I know there are lot of books there on each topic. The reason i am asking experts here is to get deeper insight and practical advise.
gudii9Author Commented:
But i will definitely follow your advise to read more on the books as much as time permit me to read
How array based queue and stack is different from   linked list  based queue and stack? Any sample example on each kind

ArrayList uses an array internally to store the "list" of values.
LinkedList uses a series of elements, each pointing to the next (and previous) in the list.

The main difference is that to get an element from a linked list you need to go through all of the elements in the list (following the links).  For the array you can go directly to the element you need.  So the array list is MUCH faster when looking up values.  In return, linked list is SLIGHTLY faster when adding elements.

So 99% of the time you should be using ArrayList.  Only in very special cases (where you do lots of inserts and few lookups) would LinkedList make sense.

Hope that helps,

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now