Created
January 15, 2013 15:28
-
-
Save rajkumar-p/4539438 to your computer and use it in GitHub Desktop.
Initialize the vector of elements
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Maps a word to the index in the vector | |
| map<string, int> wordToVectorIndex; | |
| // Push the word to the vector | |
| while (cin >> word) | |
| { | |
| element e; | |
| e.word = word; | |
| e.noOfLadders = 0; | |
| e.isVisited = ELEMENT_NOT_VISITED; | |
| e.distanceFromSource = 0; | |
| wordListDS.push_back(e); | |
| wordToVectorIndex[word] = wordIndex++; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment