[MRG] reduce amount of boiler code in tree/_utils

Inspired from the last @jnothman pull request, I simplify a bit sklearn/tree/_utils.pyx using standard tools (memcpy, one-liner swap).

Here the c code
```
  /* "sklearn/tree/_utils.pyx":222
 * 
 *         # Put last element to the front
 *         heap[0], heap[heap_ptr - 1] = heap[heap_ptr - 1], heap[0]             # <<<<<<<<<<<<<<
 * 
 *         # Restore heap invariant
 */
  __pyx_t_4 = (__pyx_v_heap[(__pyx_v_heap_ptr - 1)]);
  __pyx_t_5 = (__pyx_v_heap[0]);
  (__pyx_v_heap[0]) = __pyx_t_4;
  (__pyx_v_heap[(__pyx_v_heap_ptr - 1)]) = __pyx_t_5;
```