(Feature suggestion) SortedMultiSet
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 30/100
Línea de trabajo
Comience revisando las implementaciones existentes de SortedSet y SortedMultiDict y sus APIs. Defina cómo debe manejar un SortedMultiSet las claves de comparación duplicadas, la inserción/eliminación/búsqueda eficientes y la eliminación por valor; el issue no identifica archivos ni pruebas, por lo que los criterios de finalización tendrían que acordarse con los maintainers.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
I think that this package is missing a SortedMultiSet type. As an example, let's say we want to collect a list of persons, sorted by age, as stored in an ages dictionary:
ages = Dict(:bob => 1, :sam => 2, :joe => 1)
and perform efficient insertions/deletions and searching on this list. My first reflex is using a SortedSet for this; however: SortedSet(keys(ages), Base.Order.By(x->ages[x])) merges the keys :bob: and :joe. (*)
There are two ways to work around this limitation right now:
SortedSet((age, person) for (person, age) in ages);SortedMultiDict(age => person for (person, age) in ages).
However, both of them are somewhat memory-inefficient (they store information equivalent to a full copy of the ages database, as well as quite cumbersome to use (neither implementation allows a simple delete!(set, :bob) call). The second inconvenient may be fixed by writing a simple wrapper over either type (possibly the SortedMultiDict, which is somewhat more efficient), but the first one cannot be fixed except by writing a new structure.
(Also, keep in mind that the example I gave here is of course much simplified. In particular, the comparison values are numbers, and thus quite compact in memory. There could probably be some use cases where the comparison keys are big data structures, hence the fact that we don't want to copy all of them).
(*) in my view this is simply a bad design choice in the definition of SortedSet, because only equal values should be merged, i.e. a set should be allowed to be sorted according to a preorder, but it is likely much too late to change this.
- Lenguaje dominante
- Julia
- Estrellas
- 747
- Forks
- 261
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de JuliaCollections/DataStructures.jl
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
-
append!(l1::MutableLinkedList, l2::MutableLinkedList) fails for empty l2Posiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 30/100
JuliaCollections/DataStructures.jl#997 · 1 comentario ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
-
several `mutable struct` type definitions do not require mutability, review and adjustPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
Todos los issues de JuliaCollections/DataStructures.jl
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Add project: Typst_jll.jlPosiblemente ocupada @github-actions la tomó hoy. Abiertoadd-project
Dificultad 1/5 Menos de una hora Aptitud para principiantes 76/100
YDX-2147483647/best-of-typst#590 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100