C# Algorithms – Phone Book Implementation – List of int and string with a tuple

Today I had to write a solution of the following problem – imagine you have two lists like this:

 

What I needed to write was a program, printing the names of the users in liNumbers. Something like this. As far as using two embedded loops was pretty much the obvious solution, I have decided to go one step further and to optimize it … After all, this is algorithm implementation. Thus, I have decided to still use the two loops, but to start the inner loop only from the index which I have reached so far. As you see, in the printed version I am printing the indices of the inner loop and they do not repeat. Thus, it works better than just two loops. 🙂

PhoneBook

 

So far so good! Here comes the code:

Enjoy it! 🙂

About

VBA Developer

Tagged with: , ,