Results for “Sorting & joining records”
Small, practical examples. Search by task or narrow things down below.
Select the largest values without sorting everything
Python: Use heapq.nlargest when only a small prefix of the ranking is required.
Python✓ Tested
Separate records into two lists
Python: Build two explicit partitions so callers can use both matching and rejected values.
Python✓ Tested
Show the count of matching records
Show the count of matching records with a small React component and explicit browser behavior.
React✓ Tested
Sort records by a selected field
Sort records by a selected field using a complete Go program with explicit sample inputs.
Go✓ Tested
Sort records by two fields
C++: Tuple comparison implements lexicographic ordering across several keys.
C++✓ Tested
Write object records to a CSV file
PowerShell: Export-Csv uses property names as headers and quotes values when needed.
PowerShell✓ Tested
Add a calculated property during selection
PowerShell: A calculated property can derive a value while retaining selected original properties.
PowerShell✓ Tested
Check for a hashtable key before reading it
PowerShell: ContainsKey distinguishes a missing key from a key whose value happens to be null.
PowerShell✓ Tested
Construct a record with named properties
PowerShell: PSCustomObject gives downstream pipeline commands meaningful property names.
PowerShell✓ Tested
Convert an object’s properties into a hashtable
PowerShell: Enumerate PSObject.Properties when the set of property names is known only at runtime.
PowerShell✓ Tested
Define an immutable data record
Java: A local record gives a small Java data carrier named accessors and value semantics.
Java✓ Tested
Enumerate hashtable entries in a stable order
PowerShell: Sort entries by key when predictable output matters.
PowerShell✓ Tested