gautamrege / short_circuit
- Source
- Commits
- Network (2)
- Issues (0)
- Downloads (0)
- Wiki (1)
- Graphs
-
Branch:
master
commit 1e06b84058e47ba9d3724b7fb3d8c1943066225c
tree fa8d21597328a3e97f9ffdf4e55aa4b214cff0ef
parent 8b949dde12aa15e2dd1472d39de58566105d1b7f
tree fa8d21597328a3e97f9ffdf4e55aa4b214cff0ef
parent 8b949dde12aa15e2dd1472d39de58566105d1b7f
| name | age | message | |
|---|---|---|---|
| |
.gitignore | ||
| |
README | ||
| |
bin/ | ||
| |
circuit_diagram.png | ||
| |
lib/ | ||
| |
short_circuit.gemspec | ||
| |
solutions/ | ||
| |
test/ |
README
Short-Circuit !! Given a closed electrical circuit, we need to identify the redundant elements. For the sake of simplicity, we shall assume only resistors between various points. Electricity will flow through the path of least resistance! Source of electricity is A and the end-point is G. The aim of the program is to find the redundant resistors. As shown in the diagram we can 'translate' load between points into any simple data structures. For example: [ [ 'A', 'B', 50 ], [ 'A', 'D', 150], [ 'B', 'C', 250], [ 'B', 'E', 250], [ 'C', 'E', 350], [ 'C', 'D', 50], [ 'C', 'F', 100], [ 'D', 'F', 400], [ 'E', 'G', 200], [ 'F', 'G', 100], ] Feel free to use ANY other data structure as long as assumptions are simple and understandable. The source and the end-point may be hard-coded in the script or can be taken as command line parameters, whichever you feel is convinient. In the above example, the output expected MUST be the following array of arrays: [ [ 'A', 'B', 50 ], [ 'B', 'C', 250], [ 'B', 'E', 250], [ 'C', 'E', 350], [ 'D', 'F', 400], [ 'E", 'G', 200], ]

