Skip to main content
structcore

A comprehensive Python library for Data Structures and Algorithms.

Installation

pip install structcore

Requirement

Python version 3.8 or higher

Available DataStructure

  • Linked List
  • Stack
  • Queue
  • Deque
  • Binary Search Tree
  • Heap (Min/Max)
  • Graph (Directed/Undirected)
  • Trie

Available Algorithm

Sort Type

  • BubbleSort
  • SelectionSort
  • InsertionSort
  • QuickSort
  • MergeSort
  • HeapSort

Search Type

  • LinearSearch
  • BinarySearch
  • DepthFirstSearch
  • BreadthFirstSearch

Linked List

Private Methods

  • depth_first_search: Used for traversing data using Depth First Search within the Object
  • breadth_first_search : Used for traversing data using Breadth First Search within the Object

Public Methods

  • append: Adds an element to the end (tail) of the Object
  • appendleft: Adds an element to the front (head) of the Object
  • insert: Inserts data at the specified position and existing node at that position shifts to the right
  • pop: Removes the last element from the Object and returns the removed value
  • popleft: Removes the first element from the Object and returns the removed value
  • remove: Removes the node at the specified index in the Object
  • find: Finds the first occurrence of a value and returns the index of that node
  • reverse: Reorders the nodes in the Object by reversing the order (back to front)
  • min : Find a minimum value in object and return
  • max : Find a maximum value in object and return
  • clear: Removes all nodes from the Object

Python Magic Methods

  • __getitem__: Accesses a node value within the Object using a key via []
  • __setitem__: Modifies a node value within the Object using a key via []
  • __len__: Returns the total number of nodes in the Object
  • __contains__: Checks if a specific value exists in the Object using the in keyword
  • __iter__: Iterates through each node in the Object by yielding values one by one
  • __eq__: Compares two Objects to determine if they are the same class and have identical nodes
  • __repr__: Displays the Object type when the repr() function is called
  • __bool__: Defines whether the Object evaluates to True or False when used directly in an if statement
  • __str__: Displays all values within the Object when printed

Stack

Public Methods

  • push: Adds a new node to the top of the Object
  • update: Modifies the data of the top node in the Object
  • peek: Accesses and returns the data of the top node in the Object
  • pop: Removes the top node from the Object
  • clear: Removes all nodes from the Object
  • isEmpty: Checks whether the Object is empty

Python Magic Methods

  • __len__: Returns the total number of nodes in the Object
  • __iter__: Iterates through each node in the Object by yielding values one by one
  • __contains__: Checks if a specific value exists in the Object using the in keyword
  • __eq__: Compares two Objects to determine if they are the same class and have identical nodes
  • __repr__: Displays the Object type when the repr() function is called
  • __bool__: Defines whether the Object evaluates to True or False when used directly in an if statement
  • __str__: Displays all values within the Object

Queue

Public Methods

  • enqueue: Adds a node to the front of the Object
  • dequeue: Removes a node from the rear of the Object
  • peek: Views the data at the front of the Object
  • clear: Removes all nodes from the Object
  • isEmpty: Checks whether the Object is empty

Python Magic Methods

  • __len__: Returns the total number of nodes in the Object
  • __iter__: Iterates through each node in the Object by yielding values one by one
  • __contains__: Checks if a specific value exists in the Object using the in keyword
  • __eq__: Compares two Objects to determine if they are the same class and have identical nodes
  • __repr__: Displays the Object type when the repr() function is called
  • __bool__: Defines whether the Object evaluates to True or False when used directly in an if statement
  • __str__: Displays all values within the Object

Deque

Public Methods

  • append: Adds a node to the rear (tail) of the Object
  • appendleft: Adds a node to the front (head) of the Object
  • set_head: Modifies the data of the node at the front of the Object
  • set_tail: Modifies the data of the node at the rear of the Object
  • peek: Views the data of the node at the rear of the Object
  • peekleft: Views the data of the node at the front of the Object
  • pop: Removes the node from the rear of the Object
  • popleft: Removes the node from the front of the Object
  • clear: Removes all nodes from the Object
  • isEmpty: Checks whether the Object is empty

Python Magic Methods

  • __getitem__: Accesses a node's value within the Object using a key via []
  • __len__: Returns the total number of nodes in the Object
  • __contains__: Checks if a specific value exists in the Object using the in keyword
  • __iter__: Iterates through each node in the Object by yielding values one by one
  • __eq__: Compares two Objects to determine if they are the same class and have identical nodes
  • __repr__: Displays the Object type when the repr() function is called
  • __bool__: Defines whether the Object evaluates to True or False when used directly in an if statement
  • __str__: Displays all values within the Object

Binary Search Tree

Private Methods

  • is_equal: Checks whether two Objects are identical in both data and structure
  • inorder_asc_helper: Helper method to collect data in ascending order
  • inorder_desc_helper: Helper method to collect data in descending order
  • depth_first_search_recursive: Helper method for Depth First Search traversal
  • depth_first_search: Performs Depth First Search traversal on the Object
  • breadth_first_search: Performs Breadth First Search traversal on the Object

Public Methods

  • insert: Adds a node to the Object
  • find: Find a specific value within the Object
  • inorder_asc: Returns values in ascending order
  • inorder_desc: Returns values in descending order
  • min: Returns the smallest value in the Object
  • max: Returns the largest value in the Object
  • peek: Views the top node (Root) and returns its value
  • remove: Removes a specified node from the Object
  • clear: Removes all nodes from the Object
  • isEmpty: Checks whether the Object is empty

Python Magic Methods

  • __len__: Returns the total number of nodes in the Object
  • __contains__: Checks if a specific value exists in the Object using the in keyword
  • __eq__: Compares two Objects to determine if they are the same class and have identical values
  • __iter__: Iterates through each value in the Object by yielding values one by one
  • __repr__: Displays the Object type when the repr() function is called
  • __bool__: Defines whether the Object evaluates to True or False when used directly in an if statement
  • __str__: Displays all values within the Object

Heap

Heap is stored in a Python List.
Values can be accessed using the following formulas, where i is the index of the element:

  • parent = (i - 1) // 2
  • left child = 2 * i + 1
  • right child = 2 * i + 2 Heap is divided into two types:
  • Min Heap: smallest value at the root
  • Max Heap: largest value at the root Both types store data in an array based on the formulas above.

Class Methods

  • min_heap: Creates a new Min Heap instance
  • max_heap: Creates a new Max Heap instance

Private Methods

  • heapify_up: Organizes the Object to maintain heap property after inserting data
  • heapify_down: Organizes the Object to maintain heap property after removing data

Public Methods

  • push: Adds data to the Object
  • peek: Returns the top value of the Object without removing it
  • max: Returns the maximum value in the Object
  • min: Returns the minimum value in the Object
  • pop: Removes and returns the top value of the Object
  • clear: Removes all data from the Object
  • isEmpty: Checks whether the Object is empty

Python Magic Methods

  • __getitem__: Accesses data in the Object using a key via []
  • __len__: Returns the total number of elements in the Object
  • __iter__: Iterates through each value in the Object by yielding values one by one
  • __eq__: Compares two Objects to determine if they are the same class and have identical values
  • __contains__: Checks if a specific value exists in the Object using the in keyword
  • __repr__: Displays the Object type when the repr() function is called
  • __bool__: Defines whether the Object evaluates to True or False when used directly in an if statement
  • __str__: Displays all values within the Object

Graph

Graph is divided into two classes:

  • Directed Graph: edges have a direction (one-way)
  • Undirected Graph: edges are bidirectional (two-way)

Class Methods

  • Directed: Creates a new Directed Graph instance
  • Undirected: Creates a new Undirected Graph instance

Private Methods

  • depth_first_search: Performs Depth First Search traversal on the Object
  • breadth_first_search: Performs Breadth First Search traversal on the Object

Public Methods

  • add_vertex: Adds a vertex to the Object
  • add_edge: Adds an edge to the specified vertex
  • get_neighbors: Retrieves all edges from the specified vertex
  • has_vertex: Checks whether the specified vertex exists in the Object
  • has_edge: Checks whether the specified edge exists in the vertex
  • remove_vertex: Removes the specified vertex from the Object
  • remove_edge: Removes the specified edge from the vertex
  • clear: Removes all data from the Object
  • isEmpty: Checks whether the Object is empty

Python Magic Methods

  • __getitem__: Accesses values in the Object using a key via [] (returns edges from that vertex)
  • __len__: Returns the total number of vertices in the Object
  • __contains__: Checks if a specific vertex exists in the Object using the in keyword
  • __eq__: Compares two Objects to determine if they are the same class and have identical data
  • __iter__: Iterates through each vertex in the Object by yielding values one by one
  • __repr__: Displays the Object type when the repr() function is called
  • __bool__: Defines whether the Object evaluates to True or False when used directly in an if statement
  • __str__: Displays all values within the Object

Trie

Private Methods

  • collect_word: Helper method to collect specific data from the Object and return it
  • remove_helper: Helper method to remove a word without disrupting the Object's structure
  • depth_first_search: Performs Depth First Search traversal on the Object
  • depth_first_search_collect: Helper method for collecting data during Depth First Search
  • breadth_first_search: Performs Breadth First Search traversal on the Object

Public Methods

  • insert: Adds a word to the Object
  • find: Find for a specific word in the Object
  • starts_with: Checks if any word starts with the given prefix; returns True if found
  • get_word: Retrieves all words from the Object and returns them
  • get_word_with_prefix: Retrieves all words that start with the given prefix and returns them
  • remove: Removes a specified word from the Object
  • clear: Removes all data from the Object
  • isEmpty: Checks whether the Object is empty

Python Magic Methods

  • __len__: Returns the total number of words in the Object
  • __contains__: Checks if a specific word exists in the Object using the in keyword
  • __iter__: Iterates through each word in the Object by yielding values one by one
  • __eq__: Compares two Objects to determine if they are the same class and have identical values
  • __repr__: Displays the Object type when the repr() function is called
  • __bool__: Defines whether the Object evaluates to True or False when used directly in an if statement
  • __str__: Displays all values within the Object

Sort Type

BubbleSort

Public Function

  • bubble_sort: Sorts items in the Object using the Bubble Sort Algorithm

SelectionSort

Public Function

  • selection_sort: Sorts items in the Object using the Selection Sort Algorithm

InsertionSort

Public Function

  • insertion_sort: Sorts items in the Object using the Insertion Sort Algorithm

QuickSort

Private Functions

  • __median_of_three: Selects the pivot from the first, middle, and last elements of the partition
  • __quick_sort_in_place: Sorts the Object in-place using recursive partitioning
  • __partition: Rearranges items around the pivot into left and right partitions

Public Function

  • quick_sort: Sorts items in the Object using the Quick Sort Algorithm

MergeSort

Private Function

  • __merge: Merges two sorted sublists into a single sorted list

Public Function

  • merge_sort: Sorts items in the Object using the Merge Sort Algorithm

HeapSort

Public Function

  • heap_sort: Sorts items in the Object using the Heap Sort Algorithm

Search Type

Binary Search

Public Function

  • binary_search: Searches for a target value in the Object using the Binary Search Algorithm (requires sorted data)

Breadth First Search

Public Method

  • breadth_first_search: Searches for a target value in the Object using the Breadth First Search Algorithm

Depth First Search

Public Method

  • depth_first_search: Searches for a target value in the Object using the Depth First Search Algorithm

Linear Search

Public Function

  • linear_search: Searches for a target value in the Object using the Linear Search Algorithm

How To Use

import structcore

data = structcore.LinkedList()
data.append(20)
print(data)

message = structcore.Trie()
message.insert("Kuronanod")
print(message.find("Kuronanod"))

data = [2,41,4,2,5,7,4,8744,7,345,7]
sorted_data = structcore.quick_sort(data.copy())
answer = structcore.linear_search(sorted_data,8744)
print(answer)

License

MIT License

Copyright (c) 2026 Kuronanod

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Author

Thawankorn Suwannabon Github : Kuronanod Email : thwalkrsuwrrnbl@gmail.com

Metadata

Release files for structcore 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for structcore 1.0.1
File Size Uploaded Provenance Actions
structcore-1.0.1.tar.gz 17.9 kB With provenance Details for structcore-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for structcore 1.0.1
File Interpreter ABI Platform Actions
structcore-1.0.1-py3-none-any.whl Python 3 none any Details for structcore-1.0.1-py3-none-any.whl

Total release size: 44.3 kB

Release files / structcore-1.0.1.tar.gz

Download URL structcore-1.0.1.tar.gz
Size 17.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d5dc7dd56fd0b2618a5733e6b8006f2aa2add9229d528d9e2e1287b784726b78
BLAKE2b-256 checksum
How to use checksums
d5eb84546cc7bd04988ff2ec509169dfaf0dc4af50d6c5befb8515958ad1af7e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 17, 2026.

Transparency log

Release files / structcore-1.0.1-py3-none-any.whl

Download URL structcore-1.0.1-py3-none-any.whl
Size 26.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e55d04d96f16bdcb62d067b8bf53cd4a82e1df70f7896c5cf329679873b36318
BLAKE2b-256 checksum
How to use checksums
ffea96333896c1401a2f981da8a67521d615dfcef2ffa0db76d49fe077972967
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 17, 2026.

Transparency log

Security for structcore 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for structcore-1.0.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 17, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page