There can be several algorithms to solve a particular problem. So to choose one out of them, we have to measure the complexity of algorithm. For that the following things will have to be considered:
1. Performance requirements i.e. time complexity.
2. Memory requirements i.e. space complexity.