Skip to main content

TsingPig_Lab is a package for algorithm.

Project description

TsingPig - Lab

image.png

1. Introduction

This is a python package for simple algorithms and data structures which is developed by tsingpig.

Version: v0.1.5

Author: TsingPig

Repo: https://gitlab.com/tsingpig-code/tsingpig_lab

You can connect me by email: 1114196607@qq.com

Thanks for your support!

2. Functions

2.1. DataStructures

2.1.1 Sparse Table (ST)

A data structure ST table (Sparse Table) that supports interval contribution problem queries.

Usage

Method Description
__init__(nums: List, opt = lambda a, b: max(a, b)) Initialize the Sparse Table (ST) data structure with the given list of numbers and an optional comparison function.
qry(L: int, R: int) Query the opt value within the range [L, R].

Simple

from tsingpig_lab.DataStructures import ST as ST
st = ST([1, 9, 0, 2, 4, 5])
print(st.qry(1, 3))	# 9

You can also customize comparison methods by passing function parameters. In default condition, the maximum value will be returned.

from tsingpig_lab.DataStructures import ST as ST
st = ST([1, 9, -99, 2, 4, 5], lambda a, b: min(a, b))
print(st.qry(1, 4)) # -99

Please note that the issue of contribution needs to be met. It means $Opt (x, x)=x$

2.2. Algorithms

2.2.1 BaseConverter


 python setup.py sdist
twine upload dist/*
pip install TsingPig-Lab==0.1.4 -i https://www.pypi.org/simple/

pypi-AgEIcHlwaS5vcmcCJDMxZTVjYjEwLTI1ZjgtNDkyYy1hYjk5LTIwODhkMmRhOGU4MQACKlszLCI3NDRkODY1Ni02ODE3LTRiNjEtYTliMi1kZThmOTI0YjQ5ZWEiXQAABiA7fW5wFoRjJYg7bF0l9tnQWja3Lo-ag6U96-XcTmKChw

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

TsingPig_Lab-0.1.5.tar.gz (4.0 kB view details)

Uploaded Source

File details

Details for the file TsingPig_Lab-0.1.5.tar.gz.

File metadata

  • Download URL: TsingPig_Lab-0.1.5.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.8.6

File hashes

Hashes for TsingPig_Lab-0.1.5.tar.gz
Algorithm Hash digest
SHA256 ae092259d83aff50c0f69e62d9b0a6f9737f050ffa6b76fdc154e531a0c8e4de
MD5 26512828112f1ed7d39ed30dd34abe30
BLAKE2b-256 5638d36414ebd193e71ce8212b242c94824c83ef14d190db1eb095d090d3f11a

See more details on using hashes here.

Supported by

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