A Python Package for Competitive Programming
Project description
Fast Cp
A Python Library that contains various functions to make Competitive Programming easy. This Package includes pre-defined functions that are quite useful in Competitive Programming.
- To View the Package -> Click Here
- To View Documentation Web Page -> Click Here
Purpose of Package
- The main purpose of this package is to provide various functions that are helpful for Competitive Programming.
Features
- Collections of fastcp
- Collections of arrays
- Unique
- Subarr
- Subseq
- Freq
- Length
- Collections of strings
- VowelCount
- Freq
- Substr
- Subseq
- Collections of bitMan
- Binary
- Hexa
- Octal
- Toggle
- CountSetBits
- BinToDecimal
- OctToDecimal
- HexToDecimal
- Collections of math
- Product
- Sieve
- IsPrime
- Along with all functions in python 3.11.0 math library
- Collections of search
- Find
- LowerBound
- UpperBound
- Collections of sorting
- Sort
- SortDict
- SortDictValues
- Collections of collections
- MultMap
- Along with all functions in python 3.11.0 collections library
- Collections of trees
- Create
- Inorder
- Preorder
- Postorder
- Levelorder
- Collections of arrays
Getting Started
This package can be found on PyPi. Hence you can install it using pip
Installation
pip install fastcp
Usage
importing all sub-packages from fastcp
>>> from fastcp import *
>>> subsequences = Subseq([1,2,3,4,5])
importing a single sub-package from fastcp
>>> from fastcp import bitMan
>>> toggled_number = bitMan.Toggle(123)
Examples
>>> from fastcp import arrays
>>> arrays.Freq([1,1,2,2,2,3])
{1:2, 2:3, 3:1}
>>> from fastcp import *
>>> Substr("python")
['python', 'ython', 'thon', 'hon', 'on', 'n']
>>> Subseq("Pypi")
['Pypi', 'Pyp', 'Pyi', 'Py', 'Ppi', 'Pp', 'Pi', 'P', 'ypi', 'yp', 'yi', 'y', 'pi', 'p', 'i', '']
- New Libraries: (v.1.0.2)
- sorting
- collections
>>> from fastcp import sorting
>>> # Sort function at O(N) Complexity
>>> dict = {10: 1, 8: 2, 1: 3, 4: 4}
>>> print(sorting.SortDict(dict))
{1: 3, 4: 4, 8: 2, 10: 1}
>>> print(sorting.SortDict(dict, True))
{10: 1, 8: 2, 4: 4, 1: 3}
>>> from fastcp import *
>>> d = MultMap(0)
>>> # creates a Multi-Dictionary with default value as Int (0);
>>> d[0][0]
0
>>> d = MultMap([])
>>> # creates a Multi-Dictionary with default value as List ([]);
>>> d[0][0]
[]
>>> d[0][0].append(20)
>>> d[0][0]
[20]
>>> d = defaultdict(int)
>>> d[0]
0
>>> from fastcp import trees
>>> root = trees.Create(10)
>>> root.left = Create(5)
>>> root.right = Create(20)
>>> trees.Inorder(root)
[5, 10, 20]
>>> trees.Preorder(root)
[10, 5, 20]
>>> trees.Postorder(root)
[5, 20, 10]
>>> trees.Levelorder(root)
[[10], [5, 20]]
Author
Avinash Doddi [https://github.com/avinash-doddi]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
fastcp-1.0.4.tar.gz
(10.0 kB
view details)
Built Distribution
File details
Details for the file fastcp-1.0.4.tar.gz
.
File metadata
- Download URL: fastcp-1.0.4.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 25b8d559c8291c066b7904705eb0fcedcfd282387759a96b73e6fbcb6539a111 |
|
MD5 | 043fa54ed3243756e39248b7e2693e4a |
|
BLAKE2b-256 | bbea528a186ae5b7be6ce4e9e9604a456f5629af45d8c62f82986b2f47193b5a |
File details
Details for the file fastcp-1.0.4-py3-none-any.whl
.
File metadata
- Download URL: fastcp-1.0.4-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3cce6a7561ef668b9fcf32e83bdaed30b60dab78c28f0e6745c38607fe8d2c83 |
|
MD5 | b97b0ae23a1e65287d825483dcdb7520 |
|
BLAKE2b-256 | c8e74eaa58ac0cb90a10a9b77ad511d0ae61dffd6683ee49359636be5029d544 |