Complexity in data structures is defined for each of its actions (access, insert, delete, search) and dictionaries shine on three of these operations. Because of this, they become useful in reducing the complexity of many algorithms when you apply a clever use of them. For dictionaries, accessing, deleting and inserting operations could be achieved quickly despite the number of elements they have. So let’s pick up our headset and get to coding while we listen to smooth jazz (hint hint, Kenny G).
Let’s consider the following problem: Write a function that prints a count of how many times all letters appear in a given string. To simplify the use of dictionaries I will decide to use PHP, but this approach could be seen in almost any language. Continue reading Why I like dictionaries so much?