This Python script, Ford Flukerson.py, provides a solution to the committee assignment problem using the Ford-Fulkerson algorithm for finding maximum flow in a flow network.
The script takes input from a file, which includes details of people, committees, preferences, and capacities. It then writes the results to an output file in the following format:
-----------------------------
Person: Committees
P1 : C1 C2
P2 : C2 C4
P3 : C1 C2 C3
-----------------------------
Committee: Person
C1 : P1 P3
C2 : P1 P2 P3
C3 : P3
C4 : P2
-----------------------------
To use the script:
- Prepare an input file with the necessary details.
- Run the
Ford Flukerson.pyscript. - Check the output file for the committee assignments.
This script, RedBlack Trees.py, implements Red-Black Trees, a type of self-balancing binary search tree. It supports insertion, deletion, and various tree query operations.
The script supports the following operations:
- Insertion: Add a new node to the tree while maintaining Red-Black tree properties.
- Deletion: Remove a node from the tree while preserving Red-Black tree properties.
- Tree Queries:
- Search: Find a specific key in the tree.
- Maximum: Retrieve the node with the maximum key in the tree.
- Minimum: Retrieve the node with the minimum key in the tree.
To utilize RedBlack Trees.py:
- Import the script into your Python environment.
- Utilize the provided functions to perform tree operations.
This script provides efficient methods for managing and querying data within a Red-Black tree structure.