The first method gives you the return of a a price-weighted average, like the Dow Jones average. So I suppose it is OK to use.
The second method gives you a rebalanced EW (equal weighted) average: you initially invest the same amount (say 1000 dollars) in each stock and then you rebalance to equal weights at each point where you do the calculation. Obviously the results depend on how frequently you do the calculation; if it is very frequently (e.g. daily) it becomes somewhat unrealistic because it means you would have to buy/sell every stock every day to get back to equal dollars per stock, if one stock now has too many dollars you must sell some of it and buy more of another that has gone down in relative price. It can be done but it is an active strategy, not a passive index. With monthly or quarterly (or yearly) recalculation it is probably OK, in the sense that there is a more realistic amount of activity involved. Still I would recommend that you either NOT USE this method, or at least disclose the calculation period (e.g. EW rebalanced monthly) otherwise no one will be able to reproduce your calculation.
But the most popular indexes like the S&P index are of a third kind: market weighted indexes.
Or else, the fourth method: to compute the return to an investor you must know the number of shares of each stock that the investor owns. This is the most general method. The others are a special case of this: for example the first method assumes that the investor buys an equal number of shares in each company, which is a strange method of investing, to say the least. The second method simulates constantly buying and selling shares, as I described above.