Consider the following data set: N samples, each of which has attributes k. Generally:
1. naive KNN: O (1) [training time] + O (NK) [request time] = O (NK)
2. The naive decision tree: O (N ^ 2 * K * log (N)) [training time] + O (log (N)) [query Time] = O (N ^ 2 * K) - also for query time, we assume that the tree is balanced.
To calculate the complexity, I looked at a very simple implementation of each classifier. There are already several improvements for implementing KNN and the decision tree.
source share