Questions d'entretien

Entretien pour Machine Learning Scientist



Given a number, how to find a closest number in a series of floating point data.


Réponses aux questions d'entretien

2 réponse(s)


Use a Binary Tree data structure. It is sorted while it stores the elements. Then traverse the tree. Search is log N. In Java there is a ceiling and floor function which does a BFS traversal and tries to search the closest number rounded off, to the nearest below or above number on the basis of ceiling or Floor function.

Argho le


Just loop over the series. Calculate abs(ref_num-x_i). Remember index of last seen lowest abs difference. In the end just return the element at the index you have saved to the end. \theat(n) time \theta(1) space additionaly (besides space for series)

Aaron le

Ajouter des réponses ou des commentaires

Pour commenter ceci, connectez-vous ou inscrivez-vous.