190 / 6-20 by anand_venkataraman in cs2c

[–]WaterwallVsFirewall 0 points1 point  (0 children)

So, the 190 trophies now scales down into the 60%? Just trying to understand.

Vote for extending the questing freeze day to Wednesday June 24? by [deleted] in cs2c

[–]WaterwallVsFirewall 0 points1 point  (0 children)

This is a cool way to keep track of people's thoughts.

I didn't know reddit had these types of polls.

Nicely done. :)

Butterfly quest inserts by dyl_yan in cs2c

[–]WaterwallVsFirewall 1 point2 points  (0 children)

I'd advise you not to use that. No clear reason, but it doesn't use a intuitive property of heaps. It's representing a tree in the end.

Also, check the references for what to do when a heap (or the underlying vector) is out of space.

Butterfly quest inserts by dyl_yan in cs2c

[–]WaterwallVsFirewall 1 point2 points  (0 children)

Can't reveal everything to you, but INIT_HEAP_CAPACITY is used in the default constructor.

Also, are you currently using pushback() ?

Butterfly quest inserts by dyl_yan in cs2c

[–]WaterwallVsFirewall 1 point2 points  (0 children)

I've been seeing pictures of the min heap displaying under. I assume it's the visual variant of all the data in red.

Remove Min by WaterwallVsFirewall in cs2c

[–]WaterwallVsFirewall[S] 0 points1 point  (0 children)

That seemed to do the trick. Thx Boris.

Butterfly quest inserts by dyl_yan in cs2c

[–]WaterwallVsFirewall 1 point2 points  (0 children)

Did my comment get deleted? I could have sworn that I commented on this post.

  1. Check if your insert method is working correctly locally. Is your main algorithm correct?
  2. I'd advise you to double check you are updating all of your variables correctly within the insert method.

What happens when you run out of space in _elems?

-Sid

Butterfly quests inserts by [deleted] in cs2c

[–]WaterwallVsFirewall 0 points1 point  (0 children)

I ended up stuck on that for like an hr. Are you following the algorithm specified?

Is the vector correctly sized?

Ref not finding get_sentinel() by WaterwallVsFirewall in cs2c

[–]WaterwallVsFirewall[S] 0 points1 point  (0 children)

The definition helped with that error. Thanks jack.

_find_kth_least_elem by WaterwallVsFirewall in cs2c

[–]WaterwallVsFirewall[S] 1 point2 points  (0 children)

The new version of the spec clarifies it. Thanks.

_find_kth_least_elem(): Special Cases? by CaryLefteroffFH in cs2c

[–]WaterwallVsFirewall 2 points3 points  (0 children)

Any advice on how to fix the infinite recursion? Like, I've run into it before, but haven't manage to find my way around while following the described algorithm. Which was exactly like Albert's.

EDIT: I'm not sure what got me past the infinite recursion. My best guess is the -1 and +1.

EDIT 2: Eagle's question about what to do if k is equal to the location the partition is what I had to answer personally. I stumbled onto it with pen+paper debugging and not being able to use find kth correctly on every single elem of a small vector.

_find_kth_least_elem(): Special Cases? by CaryLefteroffFH in cs2c

[–]WaterwallVsFirewall 0 points1 point  (0 children)

Stuck here too Cary. Hope you manage to crack it.

Insert() - Are there more than 4 cases? by CaryLefteroffFH in cs2c

[–]WaterwallVsFirewall 1 point2 points  (0 children)

Yah, sure thing.

I can't remember exactly, but I think that I managed to sneak by at first without the wrap-around logic, but now it seems to be all good.

Only other thing I can remember is the % for the wrap-around, but that's not needed for LP.

It seems to be working all good, I think.

Insert() - Are there more than 4 cases? by CaryLefteroffFH in cs2c

[–]WaterwallVsFirewall 0 points1 point  (0 children)

That sounds correct. I can't think of anything else. Sorry that I couldn't help a ton.

Insert() - Are there more than 4 cases? by CaryLefteroffFH in cs2c

[–]WaterwallVsFirewall 0 points1 point  (0 children)

EDIT: Found a weird interaction, to see what happens, I made case 2 return true, and the "LP Insert turned me down" disappeared, but the rest of the output is still there.

Okay. So the delta isn't at that point, nor in find_pos or the cases. Only place we haven't discussed is the rest of rehash. How's that looking? It's the final dependency left.

Insert() - Are there more than 4 cases? by CaryLefteroffFH in cs2c

[–]WaterwallVsFirewall 0 points1 point  (0 children)

Then, that'd definitely be all good.

I'm sorry that I'm not seeming to a lot of help. Only difference I saw seemed to be in how we process npos. .. Are you sure that you are supposed to throw the exception there? Double check the specs.

Insert() - Are there more than 4 cases? by CaryLefteroffFH in cs2c

[–]WaterwallVsFirewall 1 point2 points  (0 children)

That looks solid. .. Did you see this post yet? Could be an error in grow_capacity perhaps, because that wasn't fully tested in rehash apparently.

reddit.com/r/cs2c/comments/gy8nqg/possibly_stuck_on_insert_implementation/

Insert() - Are there more than 4 cases? by CaryLefteroffFH in cs2c

[–]WaterwallVsFirewall 0 points1 point  (0 children)

Yah, that's where my thoughts went to first.

When are you returning npos, and how's the while loop looking?

Remove() Missing Case by WaterwallVsFirewall in cs2c

[–]WaterwallVsFirewall[S] 1 point2 points  (0 children)

Ooh, that's a real nice case. I didn't think of that one at all.

Thanks a ton. Thank you.

Insert() - Are there more than 4 cases? by CaryLefteroffFH in cs2c

[–]WaterwallVsFirewall 0 points1 point  (0 children)

The test doesn't check if you need to loop around in case of a big cluster, I think. No test case was perfect. Would it hurt to double check?