Discussion about this post

User's avatar
confma's avatar

very nice and informative. I really miss such topics with php implementation

Expand full comment
agoalofalife's avatar

I'd like to pay attention for two not important but significant things.

First of all, this expression ($this->length >= $this->capacity) shouldn't be like that, I suppose,

$this->length === $this->capacity is more true, because length > capacity never happen

Secondly, I noticed some problem if we do these sequence

action and how LS looks like 👇

1 step put(2, 6) -> 2(6)

2 step put(1,5) -> 2(6) -> 1(5)

3 step put(1,2) -> 1(5) -> 1(2)

4 step get(2) -> null

but 2 has to be 6 - why?

because we hadn't to evicted 2 on 3 step - 1 already exists and has to be changed position

Am i right?

Expand full comment
4 more comments...

No posts