#reversal
Wiki
›
Algorithms
›
02. Data Structures
›
1. Core Data Structures and Operations
›
1.1 Arrays and Dynamic Arrays
›
Array Reversal
Array Reversal Array reversal rearranges elements so that the first becomes the last, the second becomes the second last, and so on. You use it as a basic primitive in many algorithms, including rotation, palindrome checks, and two-pointer techniques. Problem Given an array $A$ of length $n$, transform it into: $$ A' = [a_{n-1}, a_{n-2}, \dots, a_0] $$ Algorithm Use two pointers from both ends and swap elements until they...