java - ArrayList of Array which contains TreeNode -
i want create arraylist of array consist of treenodes. trial was
arraylist<arrays<treenode>> alist = new arraylist<arrays<treenode>>(); arrays<treenode> anodes = new arraylist<treenode>();
but gives error. (utils included)
what right way of writing this? aim find minimum depth of node in binary tree(just find minimum not find node itself, ll put levels arraylist, once size not 2^j, min level j-1).
thanks in advance, help/hint/solutions...
the arrays class util class, not type you'd use array. arrays class never takes generic argument, error telling you.
if want arraylist contains arrays, you're looking this:
arraylist<treenode[]> alist = new arraylist<>();
Comments
Post a Comment