Skip to main content

Search & Sorting algorithms

Project description


Search and Sort Modules


Different Search and Sort algorithms are implemented.

For now the functionality is really basic but it should evolve to a collection of several methods for searching elements and / or sorting sequences.

HowTo:

Available Sorting algorithms:
  1. Bubble Sort
  2. Quick Sort
  3. Shell Sort
Available Searching algorithms:

(returns index or False if element not found)

  1. Binary Search
  2. Hashmap
  3. Linear Search
Extra features:

Creating a random array.

  • first parameter: length of array
  • second parameter: range of numbers

Be aware that a tuple is returned, containing the array and a random chosen number of this array.

    
    from SeaSor import SeaSor
    
    SeaSor().get_int_array(length, range)

1.1) also available for ascii array:

    from SeaSor import SeaSor
     
    SeaSor().get_ascii_array(length, charset)
  1. Remove duplicates
    from SeaSor import Search
    
    # For example you want to remove duplicates
    #    before searching the index:
    
    Search().rm_dupls([1,1,2,3])
    
    # Output: [1,2,3]
  1. Write to (and/or Read) file

Following

How to import
  1. find index number of a element in a list (here the binary search method is applied)
    from SeaSor import SeaSor
    
    get_index = SeaSor.Search().bin_index(array, target)

Create an instance

Example:

    from SeaSor import Sort

    x = Sort
    
    # Possible to set parameters for the object
    # Also possible: Sort().quick([2,3,1])
    # Or:            Sort([2,3,1]).quick()
    
    x.array = [2,3,1]
    x.quick(x)

    # Output: [1,2,3]

Available classes
    from SeaSor import SeaSor
    from SeaSor import Sort
    from SeaSor import Search
    from SeaSor import WriteRead
For more informations and instructions visit:

SeaSor Github Repository

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

SeaSor-0.1.3.5.tar.gz (4.2 kB view hashes)

Uploaded Source

Supported by

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