Skip to content

Algorithms and data structures assignments from university

Notifications You must be signed in to change notification settings

TheArcus02/AiSD-assignments

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Installation

  1. Clone the repo
    git clone https://github.com/TheArcus02/AiSD-assignments.git
  2. Install python packages
    pip install -r requirements.txt

Usage

Sorting

Set the constant variables in main.py file.

  • MAX_LEN - Lenght of data array will contain
  • STEP - Number of data sets to be messured
  • ALGORITHM - Sorting algorithm used for setTimesComplexity function
  • DATA_TYPE - Data type used for compareAlgorithms function
from merge import merge_sort

def main():
    # constants
    MAX_LEN = 50000
    STEP = MAX_LEN // 15
    ALGORITHM = merge_sort
    DATA_TYPE = 'ascending'
    ...

Uncoment one of the following functions. To either generate plot for one algorithm but all data types or to generate plot for one data type but all algorithms.

setTimesComplexity(MAX_LEN, STEP, ALGORITHM)
compareAlgorithms(MAX_LEN, STEP, DATA_TYPE, [
                      insertion_sort, selection_sort, heap_sort, merge_sort])

To run the script:

cd sorting
py main.py

QuickSort

Set the constant variables in main.py file.

  • MAX_LEN - Lenght of data array will contain (Be aware of quicksort high space complexity)
  • STEP - Number of data sets to be messured
def main():
    # constants
    MAX_LEN = 4500
    STEP = MAX_LEN // 15
    ...

To run the script:

cd quicksort
py main.py

License

Distributed under the MIT License.