0

why this error is occuring?

this is my array declaration : int[] mainTree = {1,2,4,-1,-1,5,-1,-1,3,-1,-1};

This array is being used to make a binary tree, and here -1 indicates a null value, but I cannot figure out why this error is being displayed.

  • Without seeing your code and the full stack trace of the exception, it is impossible to say. – tgdavies Nov 19 '22 at 05:41
  • That array is not related to the error. Search for other arrays of length 7. – Christoph Dahlen Nov 19 '22 at 07:50
  • Please trim your code to make it easier to find your problem. Follow these guidelines to create a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example). – Community Nov 19 '22 at 10:56

0 Answers0