Skip to main content

A powerful algorithms package

Project description

Algorithms

  • Base classes (utils)
  • Fundamentals ideas
  • Variety of algorithms implementations

Abstract algorithm

class Algorithm:

    def __init__(self, algorithm_input: AlgorithmInput):

    @abstractmethod
    def run(self) -> AlgorithmOutput:

    def check_run_time(self):

Algorithms types

Search

Searching abstract algorithm


class SearchingAlgorithm(Algorithm):
    def __init__(self, algorithm_input: SearchingAlgorithmInput):
        
    @abstractmethod
    def search(self) -> SearchingAlgorithmOutput:
        
    def run(self) -> SearchingAlgorithmOutput:
        """
        Run the algorithm
        Returns: return searching algorithm output
        """
        algoritm_output = self.search()
        self.logger.info(f"Total iterations: {algoritm_output.total_search_iterations}")
        return algoritm_output

Examples

  • Binary search

Sort

Sorting abstract algorithm

class SortingAlgorithm(Algorithm):
    def __init__(self, algorithm_input: SortingAlgorithmInput):
        
    @abstractmethod
    def get_sorted_list(self) -> SortingAlgorithmOutput:
        
    def run(self) -> SortingAlgorithmOutput:
        """
        Run the algorithm
        Returns: yield next value in schedule
        """
        return self.get_sorted_list()

Examples

  • Binary Sort
  • Bubble Sort
  • Sort

Scheduling

Sorting abstract algorithm

class SchedulingAlgorithm(Algorithm):
    def __init__(self, algorithm_input: SchedulingAlgorithmInput):
        
    @abstractmethod
    def is_done(self):
        
    @abstractmethod
    def schedule_next(self):
        
    def run(self) -> SchedulingAlgorithmOutput:
        """
        Run the algorithm
        Returns: yield next value in schedule
        """

        while not self.is_done():
            self.schedule_next()
            self.logger.info(
                f"Pool: {self.algorithm_input.pool}, "
                f"Queue: {self.algoritm_output.queue}, "
                f"Total time: {self.algoritm_output.total_time}"
            )
        return self.algoritm_output

Examples

  • Round Robin

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

falgopy-1.0.0.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

falgopy-1.0.0-py3-none-any.whl (17.9 kB view details)

Uploaded Python 3

File details

Details for the file falgopy-1.0.0.tar.gz.

File metadata

  • Download URL: falgopy-1.0.0.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for falgopy-1.0.0.tar.gz
Algorithm Hash digest
SHA256 7f4fc7fc501978ff09009ca76b0d57b2fd4d904c4fc70c23e841f0b6d567fad5
MD5 8f50b3be166c9c69a2eb45970f60da1c
BLAKE2b-256 83c8081026ad8c42b296253ce2c30a34fd3625a5fb4367bbff924de6fdcf18cb

See more details on using hashes here.

File details

Details for the file falgopy-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: falgopy-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 17.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for falgopy-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 69baf366e5f50eb928719207a4b57e647831419f787e3da6bfda296c786e6509
MD5 f08f4f81eb8221c4a04a73c3d33e4ab1
BLAKE2b-256 cd76133310e5995188ee84db6477c1ce47fc3d63e142f85a9bbe25a9c3557492

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