employer cover photo
employer logo
employer logo

Check Point Software Technologies

Employeur impliqué

Question d’entretien chez Check Point Software Technologies

How to serialize and deserialize a binary tree

Réponse à la question d'entretien

Utilisateur anonyme

10 oct. 2015

A possible solution is to have 3 elements in a line, comma-separated. The first value represents the parent value, and the 2 other values are the left/right children. (if there are duplications then you can use an ID for each node, and have the value in that line as well) For example: <br> root, a, b<br> a, c, d<br> c, e, f<br> b, x, y<br> Is a binary tree where a and b are the children of 'root', c and d are children of 'a' and so on.