4 ms·
I presume you're using C as the example language? Most modern languages have an append-to-list method/function, so your example isn't really applicable in thos
by lomnakkus 11y ago
I presume you're using C as the example language?
Most modern languages have an append-to-list method/function, so your example isn't really applicable in those langauges. For example, ArrayList#add() for Java or Vec::push[1] for Rust, etc. (Yes, these are technically dynamically sized arrays, but you can always reserve the necessary amount of space up front if you so desire.)
[1] https://doc.rust-lang.org/std/vec/struct.Vec.html#method.push https://doc.rust-lang.org/std/vec/struct.Vec.html#method.pus...