There is a direct approach where we can use KNN directly but here you have derived the whole Algorithm. Is it necessary to derive it every time you solve a problem?
K-Nearest Neigbour
Hey @abhishekkundu86, it is not necessary to always derive the whole algorithm. You can always use the predefined libraries. But writing the whole algorithm was necessary to explain you the concepts !
If you have understood the basic working of the algorithm, then you can move ahead with the further contents of the course !
I hope this clears your doubt !
Happy Learning 
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.