A package to make your life easy.
Project description
Geeeks - A simple and helpful package
Install/Upgrade our package
pip install geeeks # install
pip install --upgrade geeeks # upgrade
String Functions
- Reverse String: reverse(string)
from geeeks import StringFunctions as sf
my_string = "AnyRandomString"
rev = sf.reverse(my_string)
print(rev)
# Output: gnirtSmodnaRynA
- Make Link: make_link(string)
from geeeks import StringFunctions as sf
my_string = "Any Random String"
link = sf.make_link(my_string)
print(link)
# Output: any-random-string
Advance Algorithms
Divide & Conquer Algorithms
This package (geeeks.DnC_Algo) contains the following functions:
- binary_search(arr, x, low, high)
- bubble_sort(arr)
- merge_sort(arr, low, high)
- min_max(arr, low, high)
- quick_sort(arr, low, high)
- Binary Search
from geeeks import DnC_Algo as dnc
arr = [1,2,3,4,5]
x = 4 # Element to search
low = 0 # lowest index
high = len(arr)-1 # maximum index
res = dnc.binary_search(arr, x, low, high)
if res != -1:
print(f"Element is present at index: {res}")
else:
print("Element is not present in array!")
- Bubble Sort
from geeeks import DnC_Algo as dnc
arr = [12,9,87,6,43,55,34]
print(dnc.bubble_sort(arr))
- Merge Sort
from geeeks import DnC_Algo as dnc
arr = [1,2,3,4,5]
low = 0 # lowest index
high = len(arr) # maximum index
print(arr)
dnc.merge_sort(arr, low, high)
print(arr)
- Minimum & Maximum
from geeeks import DnC_Algo as dnc
arr = [34, 67, 78, 45]
low = 0
high = len(arr) - 1 # maximum index
minimum, maximum = dnc.min_max(arr, low, high)
print(f"Maximum: {maximum}\nMinimum: {minimum}")
- Quick Sort
from geeeks import DnC_Algo as dnc
arr = [10,9,8,7,6]
low = 0
high = len(arr)-1
print("Before quick sort: {}".format(arr))
dnc.quick_sort(arr, low, high)
print("After quick sort: {}".format(arr))
Dynamic Programming Algorithms
This package (geeeks.DP_Algo) contains the following functions:
- zero_one_knapsack(capacity, weight, profit)
- coin_change(coins, amount)
- longest_common_subsequence(str_a, str_b)
- matrix_multiplication(arr)
- 0-1 Knapsack Problem
from geeeks import DP_Algo as dp
weight = [2, 3, 4, 5]
profit = [1, 2, 5, 6]
capacity = 8
dp.zero_one_knapsack(capacity, weight, profit)
- Coin Change Problem
from geeeks import DP_Algo as dp
coins = [2,5,10]
amount = 25
dp.coin_change(coins, amount)
- Longest Common Subsequence
from geeeks import DP_Algo as dp
A,B = list("algorithm"), list("analysis")
print(dp.longest_common_subsequence(A,B))
- Matrix Multiplication
from geeeks import DP_Algo as dp
arr=[1,2,3,4,1]
print(dp.matrix_multiplication(arr))
Graph Algorithms
This package (geeeks.Graph_Algo) contains the following functions:
- dijkstra(graph)
- floyd(graph, num_vertices)
- Dijkstra's Algorithm
from geeeks import Graph_Algo as gp
graph = [[0, 5, 8, 0], [5, 0, 10, 0], [8, 10, 0, 20], [0, 15, 20, 0]]
gp.dijkstra(graph)
- Floyd-Warshall Algorithm
from geeeks import Graph_Algo as gp
INF = 999
graph = [ [0, 3, INF, 7],
[8, 0, 2, INF],
[5, INF, 0, 1],
[2, INF, INF, 0]]
gp.floyd(graph)
Greedy Algorithms
This package (geeeks.Greedy_Algo) contains the following functions:
- fractional_knapsack(values, weight, max_capacity)
- build_huffman_tree(arr, freq)
- job_scheduling(arr)
- prims_mst(graph)
- Fractional Knapsack
from geeeks import Greedy_Algo as gd
values = [280, 100, 120, 120]
weight = [40, 10, 20, 24]
max_capacity = 60
gd.fractional_knapsack(values, weight, max_capacity)
- Huffman Encoding Technique
from geeeks import Greedy_Algo as gd
arr = ['a','b','c','d','e','f']
freq = [40,30,20,5,3,2]
gd.build_huffman_tree(arr, freq)
- Job Scheduling
from geeeks import Greedy_Algo as gd
# follow this structure for the data
arr = [['j1', 5, 200],
['j2', 3, 180],
['j3', 3, 190],
['j4', 2, 300],
['j5', 4, 120],
['j6', 2, 100]
]
gd.job_scheduling(arr)
- Prim's Algorithm
from geeeks import Greedy_Algo as gd
graph = [[0,5,8,0],[5,0,10,0],[8,10,0,20],[0,15,20,0]]
print("MST acc. to Prim's is: {}".format(gd.prims_mst(graph)))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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 geeeks-0.1.1.tar.gz.
File metadata
- Download URL: geeeks-0.1.1.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8f5fe5d66e44ff626115ff34165a97def4f946c7177d6bb410eb5b7eeb5da369
|
|
| MD5 |
927cd7b9784a3e862159fd8b4bf9ee3f
|
|
| BLAKE2b-256 |
518bf92ce9da8a104a06b93d9bea2bacf932e7919f78d470862fb2905f859004
|
File details
Details for the file geeeks-0.1.1-py3-none-any.whl.
File metadata
- Download URL: geeeks-0.1.1-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0f60d3c16ed7e0eedda93d650fcc0496d0ddadfda45e9697bffba0649879d8d
|
|
| MD5 |
6d79f24ca241bb029fbee5e495d9a686
|
|
| BLAKE2b-256 |
89d26e9e984a4cf46a5fa543de6ecc4e99034523c6db4ba82a0a5328c306eee9
|