code: function insertNode(p, prev) {
      var node = {
          p: p,
          prev: null,
          next: null,
          minX: 0,
          minY: 0,
          maxX: 0,
          maxY: 0
      };
  
      if (!prev) {
          node.prev = node;
          node.next = node;
  
      } else {
          node.next = prev.next;
          node.prev = prev;
          prev.next.prev = node;
          prev.next = node;
      }
      return node;
  }
docs: create a new node in a doubly linked list