A package to find the max and min values using divide and conquer.
Project description
MaxMinConquer
maxminconquer is a Python package that implements divide and conquer algorithms for finding the maximum and minimum values in a list.
Functions
find_max(arr, left, right)- Finds the maximum value using divide and conquer.find_min(arr, left, right)- Finds the minimum value using divide and conquer.
Time Complexity
- Both
find_maxandfind_minfunctions have a time complexity of O(n) where n is the number of elements in the array. This is because in each step, the array is split into two halves, and the maximum or minimum value is recursively calculated on each half.
Usage
from maxminconquer import find_max, find_min
arr = [1, 2, 3, 4, 10, 90, -4, 5, 65, 87, 78, 98, 41]
max_value = find_max(arr, 0, len(arr) - 1)
print("Maximum value:", max_value)
min_value = find_min(arr, 0, len(arr) - 1)
print("Minimum value:", min_value)
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
maxminconquer-0.1.4.tar.gz
(2.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file maxminconquer-0.1.4.tar.gz.
File metadata
- Download URL: maxminconquer-0.1.4.tar.gz
- Upload date:
- Size: 2.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5406bd584878d7945795c1dc2f2f97ae00336ea75b9e140c1e23614dc045dc43
|
|
| MD5 |
cc74b3af8a6a62a561d251ece13f272b
|
|
| BLAKE2b-256 |
b4e536e790122014e17ff1a90ae349db047c43b460623146debf5de0530f22a1
|
File details
Details for the file maxminconquer-0.1.4-py3-none-any.whl.
File metadata
- Download URL: maxminconquer-0.1.4-py3-none-any.whl
- Upload date:
- Size: 2.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c9bf988de53b72e3a78f7d321e3a7b7d359c27e58c41ea3c0a8f7606cd80a6de
|
|
| MD5 |
3339198d46c4b46e42f635f36733c958
|
|
| BLAKE2b-256 |
325ecbe2d71ae878fb6195a4dc9e09c3f9cc21ed175285d049772a8d103a6291
|