From 379af8529beb125ba71e3ae934938a58d24f226d Mon Sep 17 00:00:00 2001 From: simran0963 Date: Fri, 11 Oct 2024 11:54:21 +0530 Subject: [PATCH] Added a conditional check for unreachable vertices by replacing infinity --- CONTRIBUTING.md | 5 +++++ PROJECTS/Dijkstra's algorithm.py | 6 +++++- profiles/Simran.md | 28 ++++++++++++++++++++++++++++ scripts/heallo_world_simran0963.js | 6 ++++++ 4 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 profiles/Simran.md create mode 100644 scripts/heallo_world_simran0963.js diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b7b0c41a5..8f8d091da 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2850,3 +2850,8 @@ - Bio: Third Year undergrad pursuing B.tech in Electronics and communication Engineering - GitHub: [op-amateur](https://github.com/op-amateur) +#### Name: [Simran](https://github.com/simran0963) + +- Place: Dehradun, Uttarakhand, India +- Bio: final Year undergrad pursuing B.tech in Computer Science and Engineering +- GitHub: [simran0963](https://github.com/simran0963) \ No newline at end of file diff --git a/PROJECTS/Dijkstra's algorithm.py b/PROJECTS/Dijkstra's algorithm.py index d3adbad4b..2e407ea8c 100644 --- a/PROJECTS/Dijkstra's algorithm.py +++ b/PROJECTS/Dijkstra's algorithm.py @@ -41,4 +41,8 @@ def dijkstra(graph, start): shortest_distances = dijkstra(graph, start_vertex) for vertex, distance in shortest_distances.items(): - print(f'Shortest distance from {start_vertex} to {vertex} is {distance}') + if distance == float('infinity'): + print(f'Shortest distance from {start_vertex} to {vertex} is unreachable') + else: + print(f'Shortest distance from {start_vertex} to {vertex} is {distance}') + diff --git a/profiles/Simran.md b/profiles/Simran.md new file mode 100644 index 000000000..3b3366ba2 --- /dev/null +++ b/profiles/Simran.md @@ -0,0 +1,28 @@ +# Simran Mehta +### Location + +Dehradun, Uttarakhand + +### Academics + +Graphic Era Hill University, Dehradun + +### Interests + +- Web development +- DSA +- AI/ML + +### Development + +- Front-end web development using React + +### Projects + +- [Hotstar Clone](https://github.com/simran0963/hotstar-clone) This website is a copy of the original Hotstar web application + + +### Profile Link + +[Simran Mehta](https://github.com/simran0963)-Github +[Simran Mehta](https://www.linkedin.com/in/mehtasimran/)-LinkedIn diff --git a/scripts/heallo_world_simran0963.js b/scripts/heallo_world_simran0963.js new file mode 100644 index 000000000..b1e7033c1 --- /dev/null +++ b/scripts/heallo_world_simran0963.js @@ -0,0 +1,6 @@ +// LANGUAGE: Javascript +// ENV: React.js +// AUTHOR: Simran Mehta +// GITHUB: https://github.com/simran0963 + +console.log('Hello, World!'); \ No newline at end of file