Skip to main content

Menu

LEVEL 0
0/5 XP
HomeAboutTopicsPricingMy VaultStats

Categories

πŸ€– Artificial Intelligence
☁️ Cloud and Infrastructure
πŸ’Ύ Data and Databases
πŸ’Ό Professional Skills
🎯 Programming and Development
πŸ”’ Security and Networking
πŸ“š Specialized Topics
HomeAboutTopicsPricingMy VaultStats
LEVEL 0
0/5 XP
GitHub
Β© 2026 CheatGridβ„’. All rights reserved.
Privacy PolicyTerms of UseAboutContact

Arrays & Strings Cheat Sheet

Arrays & Strings Cheat Sheet

Back to Programming Languages
Updated 2026-04-29
Next Topic: C# Programming Language Cheat Sheet

Arrays and strings are foundational data structures in programming, representing ordered collections and text sequences respectivelyβ€”arrays store elements in contiguous memory locations enabling constant-time indexed access, while strings are typically immutable sequences of characters. Mastering arrays and strings is essential because nearly every program manipulates collections or processes text, and understanding their memory layout and time complexity (O(1) for access, O(n) for insertion/deletion in middle positions) directly impacts performance. One key insight: strings are often implemented as character arrays but with special behaviors like immutability in many languages (Java, Python), copy-on-write semantics, and encoding concerns (ASCII vs UTF-8 vs UTF-16)β€”recognizing when operations create new objects versus modifying in-place prevents subtle bugs and performance pitfalls.

What This Cheat Sheet Covers

This topic spans 26 focused tables and 199 indexed concepts. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.

Table 1: Array FundamentalsTable 2: Array Creation and InitializationTable 3: Array Insertion and DeletionTable 4: Array Access and SlicingTable 5: Array Iteration MethodsTable 6: Array SearchingTable 7: Array SortingTable 8: Array TransformationTable 9: Array CopyingTable 10: Array Memory and PerformanceTable 11: Array Algorithms & PatternsTable 12: Array Destructuring & SpreadTable 13: Typed ArraysTable 14: String FundamentalsTable 15: String Creation and ConcatenationTable 16: String Slicing and ExtractionTable 17: String Searching and MatchingTable 18: String Case ConversionTable 19: String Whitespace OperationsTable 20: String Replacement and ModificationTable 21: String ValidationTable 22: String ComparisonTable 23: Regular ExpressionsTable 24: String EncodingTable 25: String Memory and PerformanceTable 26: String Algorithms

Table 1: Array Fundamentals

ConceptExampleDescription
indexed access
arr[0]
arr[arr.length - 1]
Retrieves element at zero-based index in O(1) time via contiguous memory address calculation.
zero-based indexing
First: arr[0]
Last: arr[n-1]
Most languages start indexing at 0 rather than 1, simplifying pointer arithmetic and offset calculations.
negative indexing
arr[-1]
arr[-3]
Counts backward from end in Python, Ruby, and via at() in JS β€” -1 refers to the last element.
length / size
arr.length
len(arr)
arr.size()
β€’ Returns total number of elements currently stored
β€’ property access is typically O(1) as length is cached.
contiguous memory
[a][b][c][d] sequential
All elements stored adjacently in RAM, enabling cache-friendly access and address calculation via base + (index Γ— element_size).

More in Programming Languages

  • C# Programming Language Cheat Sheet
  • C++ Programming Language Cheat Sheet
  • Java Cheat Sheet
  • Kotlin Cheat Sheet
  • Python Libraries Cheat Sheet
  • Scala Programming Language Cheat Sheet
View all 31 topics in Programming Languages