Results for “Sequence algorithms”
Small, practical examples. Search by task or narrow things down below.
Pair corresponding collection elements
C#: Zip stops at the shorter sequence, so validate lengths separately if mismatches are an error.
C#✓ Tested
Play a fixed digital output pattern
Arduino / C: A pattern table separates the output sequence from its timing.
Arduino / C✓ Tested
Print only the matching portions
Linux Commands: Use extended regex and -o to extract digit sequences.
Linux Commands✓ Tested
Repeat an action a fixed number of times
Use a counter and delay for a simple finite sequence.
for loop✓ Tested
Reuse an LED action with a function
Arduino / C: Put a short LED sequence in a named function and call it twice.
Arduino / C✓ Tested
Search a sorted vector
Use binary_search after ensuring C++ values are sorted.
C++✓ Tested
Separate a first item from the remaining items
JavaScript: Array destructuring and a rest element produce named pieces of a sequence.
JavaScript✓ Tested
Separate a first item from the remaining items
TypeScript: Array destructuring and a rest element produce named pieces of a sequence.
TypeScript✓ Tested
Sort values with LINQ
Create an ascending sequence from C# integer values.
C#✓ Tested
Sum integer values
Sum a C# sequence using LINQ.
C#✓ Tested
Sum vector values
Use std::accumulate with a wide initial value.
C++✓ Tested
Validate a complete identifier
C++: regex_match requires the pattern to match the complete input sequence.
C++✓ Tested