title: Implementing Dijkstra's algorithm in Java using hash code
body: <p>The implementation for my graph is the following hash table: </p>
  
  <pre><code>public class DiGraphHash{
  
  private int numNodos, numArcos;
  private TheList&lt;Nodo&gt; nodos[];
  private TheList&lt;Arco&gt; arcos[];
  private TheList&lt;Arco&gt; preds[];
  </code></pre>
  
  <p>}</p>
  
  <p>where TheList, is a list I made myself. </p>
  
  <p>For Dijkstra's algorithm I need to map The cost of each node and the path to reach that node. 
  I have the following two arrays:</p>
  
  <pre><code>   int[] cost = new cost[num_nodes];
     Nodo[] path = new Nodo[num_nodes];
  </code></pre>
  
  <p>Another important detail, is that my nodes are going to be the letters A, B, C, D. </p>
  
  <p>So when I map my nodes, for example lets say I have to assign the cost the the Node A, how do I find the position in the array?</p>
  
  <p>I was thinking of using hashcode % array.length but I am not sure if I will get collisions (take into consideration that it will be only 1 char letters)</p>
  
  <p>I am not asking about the code, and need the idea. </p>