Skip to main content

Fast timestamp-based data structure with O(log N) operations

Project description

TimestampStore

Fast data structure for (id, timestamp) pairs with O(log N) operations. Warning! Created by claude-opus-4.5 without human intervention.

Installation

pip install git+https://github.com/shutkanos/timestamp_store.git

Requirements: C++ compiler (g++, clang++, or MSVC)

Installing compiler

PowerShell:

winget install -e --id MSYS2.MSYS2

MSYS2:

pacman -S mingw-w64-x86_64-gcc

Usage

from timestamp_store import TimestampStore

store = TimestampStore()

# Add pairs
store.add(1, 100)
store.add(2, 50)
store.add(3, 150)

# Remove all with timestamp < 120
removed = store.remove_timestamp(120)
print(removed)  # [2, 1]

# Remove by id
store.remove(3)

# Create from list
store = TimestampStore([(1, 100), (2, 200)])
# Create from dict
store = TimestampStore({1: 100, 2: 200})

Complexity

Operation Complexity
add(id, timestamp) O(log N)
remove(id) O(log N)
remove_timestamp(ts) O(K) where K = removed count

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

timestamp_store-1.0.0.tar.gz (233.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

timestamp_store-1.0.0-py3-none-any.whl (231.8 kB view details)

Uploaded Python 3

File details

Details for the file timestamp_store-1.0.0.tar.gz.

File metadata

  • Download URL: timestamp_store-1.0.0.tar.gz
  • Upload date:
  • Size: 233.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for timestamp_store-1.0.0.tar.gz
Algorithm Hash digest
SHA256 12552bf3afce5770d9141b2714a2344d0056b8c7cbf1141014047cc38e6b0fb5
MD5 666a7ecabf94092403f446cd898bb884
BLAKE2b-256 3c6ff41fc654471205c42c6a0add09b3070c5acfbab6d166afb5055db9cc48f7

See more details on using hashes here.

File details

Details for the file timestamp_store-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for timestamp_store-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2db35848904cfaa793401123df66ab505db320276512d673bfc69e1c2aa9d0be
MD5 9f71e43c9f4065876c1edfe4f5a8a4ad
BLAKE2b-256 858fb6b1836e02740827a24b1f3d905acdc1b55d435f906b25fb26fa1f2db5e8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page