Linear Data Structures

Concept shape

Core
0
1
2
3
4
5
Definition

A string is a sequence of characters, often treated like an array with extra immutability rules.

Step 1 / 5
Concept shape
Current lesson

Strings Lab

Linear Data Structures Core

Strings

Welcome to the Strings concept lab. A string is a sequence of characters, often treated like an array with extra immutability rules. The must know points are: Many languages make strings immutable. Indexing and slicing costs vary by language. Character frequency maps are common. The common operations are: index, slice, compare, concatenate, scan. The complexity shape is Scan O(n), concatenate often O(n). Watch out for these pitfalls: Repeated concatenation in loops. Ignoring case, whitespace, and Unicode edge cases. Related algorithms include KMP String Search, Rabin-Karp, Trie Insert and Search.

Concept details

A string is a sequence of characters, often treated like an array with extra immutability rules.

Must know

  • Many languages make strings immutable.
  • Indexing and slicing costs vary by language.
  • Character frequency maps are common.

Complexity

Scan O(n), concatenate often O(n)

Open deeper visual structure lesson
1.0x