• lobsters__pervognsen@crustaceanson.theshelf.topM
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    25 days ago

    I think it’s almost universally the case that, whenever there’s a choice, the amortized approach is simpler and has better throughput; it’s a textbook latency vs throughput trade-off. Think of something as basic as the classic table doubling algorithm for dynamic arrays, where push is amortized O(1) time but worst-case O(n) time, compared to the simplest worst-case O(1) time incrementalized design. Similarly, relaxed deletion is an entire genre of throughput vs latency trade-offs in data structure design that increases throughput (and average-case latency, like with O(1) amortized array push) and lowers implementation complexity at the expense of worst-case latency.


    score 3 · canonical