This project implements a simple streamlit app allowing the user to iteratively create integer values, add them to a list and calculate for each iteration the median. This apps aims to minizime runtime when computing the median, using commands provided by heapq package.
- Interactive UI to create integers and send these to an backend that runs the calculation
- Direct calculation of median values on button click
- Direct visualization of median values as a simple line chart
- Runtime reduction by finding for each iteration the median in O(1) time & applying appendNum in O(logN)
- Use of heapq package to mimick a balanced binary tree search
- Create the class MedianFinder with methods appendNum() & getMedian() applied on the iterations
- Use of streamlit package to create a simple UI
- Python 3.x
- proper setup of a working directory
- Streamlit
- heapq
- pip install the streamlit package
- Make sure to save "app.py" to your venv
- Have a proper browser installed (chrome, firefox or edge)
- From your console run the command "streamlit run app.py" and press ENTER on notification
- If asked to verify email in console, press ENTER again (to move on) --> URL should be shown then
- If app does not appear in web browser -> copy the stated URL (localhost) -> paste it to new web browser window --> press ENTER
- Use (left) sidebar to input whole number manually
- Click "Add number" to append number to a list & start median calculation (number list, median, median list and line chart appear)
- To empty the browser refresh URL again
- Clone this repository
- Install required packages (see above)