title: Populate the data field of all the nodes of the tree
body: <blockquote>
    <p>A node of a binary tree has two pointers, 'left' and 'right', and two data fields, 'leftcount' and 'rightcount'. 'leftcount' specifies the number of nodes in the left subtree of the node, and 'rightcount' specifies the number of nodes in the right subtree of the node. Write an algorithm to populate the data fields of all the nodes of the tree. </p>
  </blockquote>
  
  <p>I was asked this question in an interview. I came up with a solution which was based on a postorder traversal of the tree. Can someone please guide me on this. </p>