FIND YOUR NEXT FEW LINES

Results for “Small algorithms & bit operations”

Small, practical examples. Search by task or narrow things down below.

443 snippets foundClear filters
SQL ServerGetting Started

Read the smallest and largest values

SQL Server: Use MIN and MAX without sorting and fetching every row.

SQL Server✓ Tested
PostgresGetting Started

Read the smallest and largest values

Postgres: Use MIN and MAX without sorting and fetching every row.

Postgres✓ Tested
SQLiteGetting Started

Read the smallest and largest values

SQLite: Use MIN and MAX without sorting and fetching every row.

SQLite✓ Tested
CStructures & function interfaces

Represent a small set of named states

C: An enum gives symbolic names to integer state values.

C✓ Tested
Arduino / CBinary values & packets

Require every bit in a mask

Arduino / C: Masking followed by equality tests whether all required flags are set.

Arduino / C✓ Tested
PythonStructured data & serialization

Return a small immutable named record

Python: Use NamedTuple when callers need both tuple behavior and named fields.

Python✓ Tested
SQLiteQueries & text

Search a small FTS5 table

Use SQLite’s full-text index to match a term.

FTS5✓ Tested
CBinary formats & structured parsing

Serialize a 16-bit integer in big-endian order

C: Explicit shifts make a byte format independent of the CPU’s native byte order.

C✓ Tested
Arduino / CData & storage

Set and inspect a bit flag

Store several boolean states in one byte.

bitSet✓ Tested
CNumbers & memory

Set and test bit flags

Use unsigned masks to combine and test C flags.

C✓ Tested
Arduino / CArrays & embedded state

Sort a small array in place

Arduino / C: Insertion sort needs no additional array and is suitable for small datasets.

Arduino / C✓ Tested
Linux CommandsGetting Started

Sort a small set of lines

Linux Commands: Sort a small set of lines using GNU/Linux commands in an empty practice directory.

Linux Commands✓ Tested