Tanmay Teaches Go by Tanmay Bakshi
Author:Tanmay Bakshi [Bakshi, Tanmay]
Language: eng
Format: epub
Publisher: McGraw-Hill Education
Published: 2021-10-15T00:00:00+00:00
This first section starts by creating the cost and parent (dist and prev) dictionaries and initializes them in the way that was described at the beginning of the chapter. The costs are all infinite and the parents are all nil. (In this case, nil is represented as an empty string, because the value is not a pointer.) We also create the dictionary that represents whether or not a node has been visited, and we set the distance, which is the cost, for the source node to 0.
This section of the code has one simple responsibility: start a for loop with the variable u that starts with the source string, and then loops until the u variable is equal to an empty string. After every iteration, call the getClosestNonVisitedNode function, pass it the dictionaries it needs, and store the result in u. The logic behind this line is that when this function returns an empty string, weâve already visited all the nodes and can stop the loop.
After we start the loop itself, we simply query the cost and distance dictionary for the node that weâre on and store that distance in uDist.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Deep Learning with Python by François Chollet(12644)
Hello! Python by Anthony Briggs(9947)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9822)
The Mikado Method by Ola Ellnestam Daniel Brolund(9813)
Dependency Injection in .NET by Mark Seemann(9368)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8332)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7788)
Grails in Action by Glen Smith Peter Ledbrook(7719)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7590)
Becoming a Dynamics 365 Finance and Supply Chain Solution Architect by Brent Dawson(7388)
Microservices with Go by Alexander Shuiskov(7148)
Practical Design Patterns for Java Developers by Miroslav Wengner(7070)
Test Automation Engineering Handbook by Manikandan Sambamurthy(7011)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6443)
Angular Projects - Third Edition by Aristeidis Bampakos(6430)
The Art of Crafting User Stories by The Art of Crafting User Stories(5956)
NetSuite for Consultants - Second Edition by Peter Ries(5870)
Demystifying Cryptography with OpenSSL 3.0 by Alexei Khlebnikov(5682)
Kotlin in Action by Dmitry Jemerov(5092)
