Random Forest vs K Nearest Neighbor as non linear classifier
It is unusual to have such a bad question as an assignement. Maybe it's just misguided phrasing by the question author, but I'm pretty sure that the vast majority of experts in ML consider the idea of &quot;best ML algorithm in general&quot; as a mistake.
First let me explain why this is a bad question: in ML there is no way to guarantee that a particular algorithm/method performs better than any other on any dataset in general. There can be exceptions under very specific constraints, but there is no algorithm which is universally the best for non-linearly separable classes. There is actually a theoretical result called the No Free Lunch Theorem which is often interpreted as a proof that there cannot be a universally best classification/regression algorithm.
Now that the context of this bad question is clearly established, as a subjective personal opinion my answer would be based on interpreting the question as: which algorithm is the least sensitive to linear separability? In this context I would say kNN because this method is not concerned at all about linear separability: a new instance is classified based on its closest instances in the training data, so it does not rely on separating the data points into groups at all.