title: Routing table optimization
body: <p>The problem i am trying to solve is, I have routing table </p>
  
  <ul>
  <li>|src|dest|port|</li>
  <li>| a | b  | p1 |</li>
  <li>| a | b  | p2 |</li>
  <li>| a | b  | p3 |</li>
  <li>| a | c  | p1 |</li>
  <li>| a | d  | p2 |</li>
  <li>| a | e  | p3 |</li>
  </ul>
  
  <p>This can be optimized to </p>
  
  <ul>
  <li>|src|dest|port|</li>
  <li>| a | b  |p1,p2,p3|</li>
  <li>| a | c  | p1 |</li>
  <li>| a | d  | p2 |</li>
  <li>| a | e  | p3 |</li>
  </ul>
  
  <p>Which can further be optimized to </p>
  
  <ul>
  <li>|src|dest|port|</li>
  <li>| a |b,c | p1 |    </li>
  <li>| a |b,d | p2 |</li>
  <li>| a |b,e | p3 |</li>
  </ul>
  
  <p>I thought of using 3 dimensional representation to solve this problem but again the retrieval will be complicated.
  I need to use the best data structure to solve this use case.</p>