4 ms·
Sure, in those other languages you could just define a single-field class to wrap the reference to the next node, since you can only pass objects by reference a
by nybble41 6y ago
Sure, in those other languages you could just define a single-field class to wrap the reference to the next node, since you can only pass objects by reference and references themselves are (usually) not objects. Unfortunately this adds a lot of overhead, both in lines of code and runtime. Instead you would probably just use the less efficient algorithm with more special cases to work around the lack of indirect references.