barelyhuman / barelyhuman/availability-bitmap

Base

Open
#1 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Here's the basic algorithm .

### Problem

1. Availability ranges are based off of a simple single element array which is then modified to handle the areas that have been booked or blocked.
2. These areas are not accessible anymore and thus cannot be locked again.

A simple implementation of the above can be found here
https://snips.reaper.im/snippets/availability-ranges.html

Obviously the above has quite a few cases which aren't handled and the space and time complexity of the above is off the charts for something so simple.

### Possible Solution

1. Construct the range based on a given number of slots, example a 24 hour availability would add up to be a 1440 slots each pointing to 1 minute
2. each slot acts as a boolean point of whether blocked or not.
3. you can then create multiple such bitmaps to handle blocking of multiple spaces and this could be a much faster way to find based on the keying logic, so then you can use the key to find the last booked point in the bitmap and also more flexible since the slots actually have no other meaning, thus being a little more generic

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.