<hightower2>
no no I mean, my issue is not difference in version between shards and crystal. I just want crystal 0.35.1 on alpine
<FromGitter>
<Blacksmoke16> the docker imagine would be easiest
<FromGitter>
<Blacksmoke16> or just download the `0.35.1` binary off github
<straight-shoota>
0.35.1 is in the package repository for alpine 3.13, you should be able to install it on other alpine releases using `apk --repository`
alexherbo26 has joined #crystal-lang
<straight-shoota>
apart from that, dockerimage `crystallang/crystal:0.35.1-alpine` or just the tarball from github releases should work, too
alexherbo2 has quit [Ping timeout: 260 seconds]
alexherbo26 is now known as alexherbo2
dostoyevsky has quit [Quit: leaving]
dostoyevsky has joined #crystal-lang
hightower2 has quit [Ping timeout: 256 seconds]
_ht has quit [Read error: Connection reset by peer]
_ht has joined #crystal-lang
_ht has quit [Ping timeout: 246 seconds]
_ht has joined #crystal-lang
_ht has quit [Read error: Connection reset by peer]
_ht has joined #crystal-lang
<Andriamanitra>
is stdlib Array's insertion (in the middle) O(1)? if not is there any ordered stdlib collection that does have fast insertions in the middle?
<Andriamanitra>
or i guess partially ordered (heap) would be good enough for my problem too
<FromGitter>
<jrei:matrix.org> Not 100% sure, I think it is
<FromGitter>
<jrei:matrix.org> What I'm sure it Deque or Hash are not O(1)
<straight-shoota>
inserting in the middle can't be O(1) for array because it need to shift items to the left/right
<FromGitter>
<jrei:matrix.org> ha right
<FromGitter>
<jrei:matrix.org> I missread
<FromGitter>
<jrei:matrix.org> but changing a value in the middle is O(1)
<FromGitter>
<jrei:matrix.org> your best bet is to know the size of the array in advance
<Andriamanitra>
i'm doing a codewars problem so i'm limited to stdlib
<Andriamanitra>
i guess i'll have to code my own heap
<FromGitter>
<jrei:matrix.org> you don't know the size?
<straight-shoota>
yeah, stdlib doesn't have that
<straight-shoota>
(at least not in the public API, there are some internal linked list implementations=
<Andriamanitra>
also i don't think linked list is good enough, it's O(n) for inserting in the middle
<Andriamanitra>
or well i guess the insertion itself is fast but you need to find the index first which is O(n)
<straight-shoota>
yeah it's only constant if you already have the position where you want to insert
<FromGitter>
<jrei:matrix.org> How can anything be O(1) if we don't know the size? A malloc will be needed at some point anyway
<straight-shoota>
yeah I can't see how O(1) would be possible inserting in the middle of any data structure
<Andriamanitra>
could be that O(log n) is the best possible
<FromGitter>
<jrei:matrix.org> ...I don't really understand: what's is wanted at the end?
<FromGitter>
<jrei:matrix.org> you've already tried Array and didn't work well, or cant use it?
<Andriamanitra>
i've tried a bunch of things and nothing was fast enough so far -- the problem requires solution to be O(n log n) and my attempts were i think O(n^2)
<Andriamanitra>
basically i will need something that stays sorted as i add stuff to it, so probably a heap or other tree structure
<FromGitter>
<watzon:matrix.org> Could you share the problem?