Code Explainers
Code explainers tagged #sorting
python
from pathlib import Path def print_tree(root, prefix="", show_hidden=False):
Printing a directory tree with recursion
recursion
filesystem
sorting
Intermediate
6 steps
rust
use std::collections::HashMap; pub fn word_frequencies(text: &str) -> HashMap<String, usize> { let mut counts: HashMap<String, usize> = HashMap::new();
Counting and ranking words in Rust
hashmap
iterators
sorting
Intermediate
7 steps
javascript
import { useMemo, useState } from 'react'; function ProductList({ products }) { const [query, setQuery] = useState('');
Memoizing a filtered list in React
memoization
derived-state
filtering
Intermediate
8 steps
python
def two_sum_sorted(numbers, target): """Find indices of two values that sum to target in a sorted array.""" left, right = 0, len(numbers) - 1 while left < right:
Two-pointer search on sorted arrays
two-pointers
arrays
sorting
Intermediate
9 steps
java
public final class Quicksort { private Quicksort() { }
Quicksort with Lomuto partitioning in Java
recursion
divide-and-conquer
in-place
Intermediate
7 steps