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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:39:36+00:00 2026-05-25T11:39:36+00:00

Lets say I have an array as: int a[]={4,5,7,10,2,3,6} when I access an element,

  • 0

Lets say I have an array as:

int a[]={4,5,7,10,2,3,6}

when I access an element, such as a[3], what does actually happen behind the scenes?
Why do many algorithm books (such as the Cormen book…) say that it takes a constant time?

(I’m just a noob in low-level programming so I would like to learn more from you guys)

  • 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-25T11:39:36+00:00Added an answer on May 25, 2026 at 11:39 am

    Just to be complete, “what structure is accessed in linear time?” A Linked List structure is accessed in linear time. To get the n element you have to travel through n-1 previous elements. You know, like a tape recorder or a VHS cassette, where to go to the end of the tape/VHS you had to wait a long time 🙂

    An array is more similar to an hard disk: every point is accessible in “constant” time 🙂

    This is the reason the RAM of a computer is called RAM: Random Access Memory. You can go to any location if you know its address without traversing all the memory before that location.

    Some persons told me that HD access isn’t really in constant time (where by access I mean “time to position the head and read one sector of the HD”). I have to say that I’m not sure of it. I have googled around and I haven’t found anyone speaking of it. I DO know that the time isn’t linear, because it is still accessed randomly. In the end, if you think that HD access isn’t constant enough for you (but then, what is constant? the access of the RAM? considering Cache, Prefetching, Data Locality and Compiler optimizations?), feel free to consider the sentence as An array is more similar to an USB disk stick: every point is accessible in “constant” time 🙂

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

Sidebar

Related Questions

Lets say I have this array, int[] numbers = {1, 3, 4, 9, 2};
Lets say I have an array numbers that contains the following values: int numbers
Lets say I have an array like int arr[10][10]; Now i want to initialize
Let's say I have a 2D array: int[][] a = new int[4][3]; populated such
Lets say I have a array defined in Groovy like this def int[] a
Lets say I have the array: int[] taco = {0, 1, 2, 3, 4,
Lets say I have an array of interlaced data, such as 1a2b3c4d5e, and I
Let's say I have a C# variable and array: int variable_1 = 1; int[3]
Lets say I have an array like this: string [] Filelist = ... I
Lets say I have an array which has n dimensions. Now in order to

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.