Skip to content

Add sorted_set::SortedSet data structure#17

Draft
crodas wants to merge 3 commits intomainfrom
feature/sorted-set
Draft

Add sorted_set::SortedSet data structure#17
crodas wants to merge 3 commits intomainfrom
feature/sorted-set

Conversation

@crodas
Copy link
Owner

@crodas crodas commented Dec 9, 2021

The sorted set is a Set but sorted by a provided score associated to the
value.

Internally a B-Tree (to sort by score) and a HashMap are used (Value,
Score).

Commands:

  • BZMPOP
  • BZPOPMAX
  • BZPOPMIN
  • ZADD
  • ZCARD
  • ZCOUNT
  • ZDIFF
  • ZDIFFSTORE
  • ZINCRBY
  • ZINTER
  • ZINTERCARD
  • ZINTERSTORE
  • ZLEXCOUNT
  • ZMPOP
  • ZMSCORE
  • ZPOPMAX
  • ZPOPMIN
  • ZRANDMEMBER
  • ZRANGE
  • ZRANGEBYLEX
  • ZRANGEBYSCORE
  • ZRANGESTORE
  • ZRANK
  • ZREM
  • ZREMRANGEBYLEX
  • ZREMRANGEBYRANK
  • ZREMRANGEBYSCORE
  • ZREVRANGE
  • ZREVRANGEBYLEX
  • ZREVRANGEBYSCORE
  • ZREVRANK
  • ZSCAN
  • ZSCORE
  • ZUNION
  • ZUNIONSTORE

@crodas crodas self-assigned this Dec 9, 2021
@crodas crodas force-pushed the feature/sorted-set branch 9 times, most recently from c167419 to 73be753 Compare December 29, 2021 05:44
@crodas crodas force-pushed the feature/sorted-set branch from 73be753 to c2aa09b Compare January 3, 2022 03:32
@crodas crodas force-pushed the feature/sorted-set branch from c2aa09b to d9c06f8 Compare January 13, 2022 13:24
@crodas crodas force-pushed the feature/sorted-set branch from d9c06f8 to 740c9be Compare July 20, 2022 19:53
@crodas crodas force-pushed the feature/sorted-set branch from 740c9be to 5e87f8e Compare August 3, 2022 05:41
@crodas crodas force-pushed the feature/sorted-set branch 3 times, most recently from a71964b to ed41cbc Compare June 28, 2023 05:14
@crodas crodas marked this pull request as draft January 23, 2024 05:51
@crodas crodas force-pushed the feature/sorted-set branch 3 times, most recently from c02ce64 to 10b0a76 Compare January 24, 2024 22:45
if args.len() % 2 != 0 {
return Err(Error::Syntax);
}
if args.len() != 2 && option.incr {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personal opinion but why not do a match?

    match v {
        _ if v.is_empty() => return 1,
        _ if v.len() % 2 != 0 => return 2,
        _ if v.len() != 2 && option.incr => 3,
        _ => return 4,
    };

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's rather interesting, I like it 😄

The sorted set is a Set but sorted by a provided score associated to the
value.

Internally a B-Tree (to sort by score) and a HashMap are used (Value,
Score).
@crodas crodas force-pushed the feature/sorted-set branch from 10b0a76 to 23726a7 Compare January 26, 2024 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants