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.

Files for py-set, version 0.1.3
Filename, size File type Python version Upload date Hashes
Filename, size py_set-0.1.3.tar.gz (4.2 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page