Easy Data Structures Arrays & Strings
What are the time complexities for common array operations?
Answer
For arrays: Access by index is O(1), Search (unsorted) is O(n), Search (sorted with binary search) is O(log n), Insertion at end (with space) is O(1), Insertion at beginning/middle is O(n) due to shifting, Deletion is O(n) due to shifting. Arrays excel at random access but are costly for insertions and deletions that require element shifting.
IIT Certified
Master These Concepts with IIT Certification
175+ hours of industry projects. Get placed at Bosch, Tata Motors, L&T and 500+ companies.
Relevant for Roles
Software Engineer Backend Developer Full Stack Developer