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 6891579
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:25:41+00:00 2026-05-27T06:25:41+00:00

For a project we have to optimize code to calculate a certain prime number.

  • 0

For a project we have to optimize code to calculate a certain prime number. My question is in terms of time how much faster or slower is it to initialize a Linked list in comparison to an array. Obviously with smaller amounts of data it is negligible however we are working with 100,000,000 different data points so in this case it does make a difference.

  • 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-05-27T06:25:41+00:00Added an answer on May 27, 2026 at 6:25 am
    • If you allocate ALL 100,000,000 points at once, array allocation is a single, constant time operation.

    • For linked lists, if you’re allocating ALL numbers at once, then your lookups will be prohibitively slow.

    • If optimizing for space : use the linked list, since it will never be any larger than necessary, and deletions can easily free up memory. If optimizing for time, the array will be faster for lookups.

    • If you have to choose quickly, then the array is probably the way to go. I’ve never seen a complex mathematical algorithm implemented in a linked list. Linked lists are usually just good for learning the fundamentals of memory, computation, and pointers — they don’t seem to have much algorithmic value.

    • Finally, with collection types, you might get the best of both worlds – the initial time will be small for initialization, but once the collection gets to a given size, there might be a moment where it has to reallocate some new memory.

    Practically speaking
    I rarely find that a linked list or arrays are all that necessary … Most jobs do alot better with a abstract collection type (i.e. a vector). But I am surmising that this is a homework assignment… Maybe consider adding that tag to the post ?

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

Sidebar

Related Questions

Need a much Optimized code.Well I Got a Project and I have Succefully made
For a particular project I have, no server side code is allowed. How can
In my DSL project I have a shape with a number of decorators that
I have a small dummy project in VS 2008, contains only the following code
i have the following code in my zf project : $index = Zend_Search_Lucene::open(APPLICATION_PATH .
I have some C code in an iOS project that I would like to
In a project have been involved in I needed to render tables with columns
I want to apply NTFS-Search to our project. Our project have to find the
I have project that I'm working on that is going to require a webserver.
I have a C++ project that have like 15+ external libraries installed with a

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.