Okay so here is the situation: You have two subsitutions, methyl and 1-methylpropyl as the two substituents here. You wish to know in which order the substituents must be written in the name. You knew that substituents are arranged alphabetically, and both methyl and 1-methylpropyl start with the same letter m.
Consider a dictionary. It has over thousands of words that start with the letter C. But we can still arrange the words in order by looking at the second, third, fourth, fifth, etc. letters of the names. Similarly, if the first letters are the same, look at the second, third and fourth letters.
Here's where we arrive at the conclusion. methylpropyl will be ranked below methyl as per dictionary order. Thus the name of the compound would, in fact, be 2,2,7-trimethyl-4-(1-methyl-propyl)-nonane and the other name is not accepted.
I believe you can continue from here to name the second compound.
Important notes:
The inclusion of di, tri in the name must only be applied for complex subsituents such as in the case of 5-(dimethylethyl)decane. In cases such as 4-ethyl-5,5-dimethyldecane, do not use d as the starting letter. This is becase d is not the part of the name of the subsitituent (methyl) and only indicates how many times this subsitituent occurs in the compound.
Do not add hyphens between methyl and decane such as "methyl-decane". Use "methyldecane" Hyphens must only be used between numbers and subsituents for which the number represents its position in the name.