String: Data Structure & Related Programs

A string is a collection of characters—letters, numbers, spaces, and symbols. In programming languages like Java, Python, and C++, strings are treated as a distinct data type with rich manipulation features.

In DSA, several key operations revolve around strings:

Searching: Finding a specific pattern or substring inside a string. Example: Searching **"world"** in **"hello world"** returns the starting index.

Sorting: Strings can be sorted lexicographically. Example: sorting `"apple", "banana", "cherry"` results in the same order.

Substrings: A substring is a contiguous sequence of characters. Example: In `"programming"`, the substring `"gram"` appears from index 3 to 6.

String Operations: Includes concatenation, splitting, formatting, etc. Example: `"hello" + " world"` → `"hello world"`.

Introduction
String Programs