title: Printing Dijkstra SSSP with recursion and in reverse order
body: <p>I'm trying to print out the SSSP in a specific order but I'm stucked.</p>
  <p>lets say I have 2 array:</p>
  <p>node = [0, 1, 2, 3]
  pred = [-1, 2, 0, 1]</p>
  <p>This is the code I've come up with:</p>
  <pre><code>void printPath (int currentNode) {
      if (pred[currentNode] == -1) {
          printf(&quot;%d\n&quot;, currentNode);
          return;
      } else {
          printf(&quot;%d-&quot;, currentNode);
          return printPath (pred[currentNode]);
      }
  }
  
  printPath(1);
  </code></pre>
  <p>This code returns the path for node 1 as: 1-2-0. When the result I want is 0-2-1.</p>
  <p>Can this result be achieved with the recursive function I wrote?</p>
  <p>Thanks a lot!</p>