Re: arrays vs. vectors
- From: bh@xxxxxxxxxxxxxxxxxxxxxxx (Brian Harvey)
- Date: Sat, 28 Jan 2006 00:45:27 +0000 (UTC)
"H." <hbe123@xxxxxxxxx> writes:
>When a language exists that has an array type and a vector type (e.g.
>Java), how do the array and vector types in those languages correspond
>to the vector type in Scheme? Did Scheme pack everything into one type
>for which other languages need two?
A Java array is like a Scheme vector.
A Java vector is an attempt to have one's cake and eat it too. It's an
array that you add elements to, one by one, like CONS, and when you fill
it up, it automatically replaces itself with a bigger one. So lookup
is Theta(1), and insert is also Theta(1) but every so often there's a
Theta(N) delay as it copies itself.
.
- Follow-Ups:
- Re: arrays vs. vectors
- From: Lauri Alanko
- Re: arrays vs. vectors
- References:
- arrays vs. vectors
- From: H.
- arrays vs. vectors
- Prev by Date: Re: How to destroy a system
- Next by Date: Re: arrays vs. vectors
- Previous by thread: Re: arrays vs. vectors
- Next by thread: Re: arrays vs. vectors
- Index(es):