Skip to main content

C extension module actualizing red-black search tree for Python3

Project description

Pyset

Build Status

PySet is wrapper of C++ standart red-black tree realization(std::set)

Install

pip3 install py_set

Usage

>>>from py_set import pyset
>>>rbt = pyset()
>>>
>>>rbt.size()
0
>>>rbt.is_empty()
1
>>>rbt.add("Hello world")
>>>rbt.add(20.15)
>>>rbt.add(6)
>>>
>>>rbt.to_list()
[20.15, 'Hello world', 6]
>>>rbt.remove(6)
>>>rbt.size()
2
>>>del rbt
>>>
>>>rbt = pyset(5, 10, 1)
>>>rbt.to_list()
[5, 6, 7, 8, 9]
>>>
>>>rbt.from_list([1, 2, 3, 4], (10, 11, 12))
>>>rbt.to_list()
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
>>>rbt.find(4)
1
>>>rbt.find("Hello")
0
>>>rbt.clear()
>>>rbt.to_list()
[]
>>>rbt.remove("Nothing")
>>>rbt.pop("Error")
IndexError: Pyset is empty

>>>del rbt

Comparing with python structures:

*** Adding elements ***
List time on adding 10^6 items: 142.03ms
Set time on adding 10^6 items: 168.01ms
Pyset time on adding 10^6 items: 457.31ms

*** Searching for elements ***
Set time on searching in 10^6 items: 178.88ms
Pyset time on searching in 10^6 items: 773.05ms

*** Deleting elements ***
Set time on deleting 10^6 items: 154.70ms
Pyset time on deleting 10^6 items: 348.18ms

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

py_set-0.1.3.tar.gz (4.2 kB view details)

Uploaded Source

File details

Details for the file py_set-0.1.3.tar.gz.

File metadata

  • Download URL: py_set-0.1.3.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.8

File hashes

Hashes for py_set-0.1.3.tar.gz
Algorithm Hash digest
SHA256 52a7f3abf60334ed819dbc3ab8b9f31969434ea09fc8587822fe65b14f163994
MD5 135c84e3954c73eb8fcaf864365906e7
BLAKE2b-256 76e3bca2c22cd9fcdd9fe8e7f77837179878ae5d9e8539acda0318c545ba64bc

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