Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7966233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T06:22:18+00:00 2026-06-04T06:22:18+00:00

Yes, this is an old topic, but I still have some confusions. In Java,

  • 0

Yes, this is an old topic, but I still have some confusions.

In Java, people say:

  1. ArrayList is faster than LinkedList if I randomly access its elements. I think random access means “give me the nth element”. Why ArrayList is faster?

  2. LinkedList is faster than ArrayList for deletion. I understand this one. ArrayList’s slower since the internal backing-up array needs to be reallocated. A code explanation:

    List<String> list = new ArrayList<String>();
    list.add("a");
    list.add("b");
    list.add("c");
    list.remove("b");
    System.out.println(list.get(1)); //output "c"
    
  3. LinkedList is faster than ArrayList for insertion. What does insertion mean here? If it means to move some elements back and then put the element in the middle empty spot, ArrayList should be slower than LinkedList. If insertion only means an add(Object) operation, how could this be slow?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T06:22:20+00:00Added an answer on June 4, 2026 at 6:22 am

    ArrayList is faster than LinkedList if I randomly access its elements. I think random access means “give me the nth element”. Why ArrayList is faster?

    ArrayList has direct references to every element in the list, so it can get the n-th element in constant time. LinkedList has to traverse the list from the beginning to get to the n-th element.

    LinkedList is faster than ArrayList for deletion. I understand this one. ArrayList’s slower since the internal backing-up array needs to be reallocated.

    ArrayList is slower because it needs to copy part of the array in order to remove the slot that has become free. If the deletion is done using the ListIterator.remove() API, LinkedList just has to manipulate a couple of references; if the deletion is done by value or by index, LinkedList has to potentially scan the entire list first to find the element(s) to be deleted.

    If it means move some elements back and then put the element in the middle empty spot, ArrayList should be slower.

    Yes, this is what it means. ArrayList is indeed slower than LinkedList because it has to free up a slot in the middle of the array. This involves moving some references around and in the worst case reallocating the entire array. LinkedList just has to manipulate some references.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok, yes, I've read the other Qs regarding this topic, but I have several
(Before anyone says anything Yes this was homework but i have already turned it
I know the Sales pitch answer is yes to this question, but is it
Yes I know, this title isn't really helpfull but this is the exact problem.
Yes, this will be a homework (I am self-learning not for university) question but
[ Old question title used to be ARC is set to YES, but xcode
Yes this is an old db (we are in the process of migrating). Somehow,
So lets say I have a dataset based on: SELECT TopicLink.*, Topic.Name AS FromTopicName,
Delphi 1 16-bit (yeah it's old, but it works well) Some sample code: procedure
yes this is an iOS programming question. I need to calculate the exact time

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.