slice() is used to split the array into left and right subarrays, allowing recursive construction of the treeâs subtrees.