Skip to content

dmitryv/trains

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

First of all, I define all distances in the map a positive integer by default.

There're two kind of questions:

1. calculate distance(Question: 1, 2, 3, 4, 5)

Just calculate it step by step and return NO SUCH ROUTE when a node is unreachable.

2. shortest route(Question: 8, 9) and number of trips(Question: 6, 7, 10)

Both of them are typical search-releated question. Both BFS and DFS works and I choose BFS.

Usage

Run code to solve the problem

> cd trains
> python3 trains.py

Run UnitTest

> cd trains
> python3 test.py

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages