Suggest an editImprove this articleRefine the answer for “What is the time complexity of accessing an element in an array?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)The time complexity of accessing an element in an array is **O(1)** (constant): the processor calculates the element's address with a formula and accesses the needed memory cell directly. **Key point:** access time is the same regardless of the array's size, but searching by value (rather than by index) is already O(n).Shown above the full answer for quick recall.Answer (EN)ImageThe time complexity of accessing an element in an array is **O(1)** (constant). --- ### **Why** An array is stored **in a contiguous memory area**, and each element has a fixed size. To find the element at index `i`, the processor simply calculates its address using the formula: [ \text{address} = \text{start_address} + i \times \text{element_size} ] That is, access requires no traversal or search, just **one arithmetic operation and one memory access**. --- ### **What this means** - It doesn't matter how many elements are in the array, 10 or 10 million, the time to get any element is the same. - That's why operations like `arr[i]` run in constant time. --- ### **Important** - **O(1)** is the ideal case for access. - But searching *by value* (for example, "find the number 42 in the array") is already **O(n)**, because every element has to be checked. --- **Summary:** > Accessing an array element by index runs in **O(1)**, instantly, regardless of the array's size.For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.