aklepatc ([personal profile] aklepatc) wrote2024-05-08 01:34 pm

Strange Container

Code a data structure with 2 operations: push() and popMostFrequent().

Most of the meat is in the comments/discussion below.

[personal profile] sassa_nf 2024-05-09 07:42 am (UTC)(link)
Good point about clearing the reference. But the order may matter.

Eg

v, c.L[j], c.L[j][0] = c.L[j][0], c.L[j][1:], nil

c.L[j][0] on the left - does that refer to the c.L[j] before or after assignment of c.L[j][1:] to it?