The zeroth-order general Randić index (usually denoted by [Formula: see text]) and variable sum exdeg index (denoted by [Formula: see text]) of a graph [Formula: see text] are defined as [Formula: see text] and [Formula: see text], respectively, where [Formula: see text] is degree of the vertex [Formula: see text], [Formula: see text] is a positive real number different from 1 and [Formula: see text] is a real number other than [Formula: see text] and [Formula: see text]. A segment of a tree is a path [Formula: see text], whose terminal vertices are branching or/and pendent, and all non-terminal vertices (if exist) of [Formula: see text] have degree 2. For [Formula: see text], let [Formula: see text], [Formula: see text], [Formula: see text] be the collections of all [Formula: see text]-vertex trees having [Formula: see text] pendent vertices, [Formula: see text] segments, [Formula: see text] branching vertices, respectively. In this paper, all the trees with extremum (maximum and minimum) zeroth-order general Randić index and variable sum exdeg index are determined from the collections [Formula: see text], [Formula: see text], [Formula: see text]. The obtained extremal trees for the collection [Formula: see text] are also extremal trees for the collection of all [Formula: see text]-vertex trees having fixed number of vertices with degree 2 (because the number of segments of a tree [Formula: see text] can be determined from the number of vertices of [Formula: see text] having degree 2 and vice versa).