Exercise 5.2 is about the calculation of the Value At Risk of a sample.

Do we only need to use the Variance-Covariance method (using the first moments calculated in ex. 5.1), or do we need to sort all the payoff outcomes of the radom draws to get the x% lowest values for a 100-x confidence interval?

In the latter case, since we need to sort the payoff outcomes, what is the most memory-optimal strategy (creating a vector of all the draws outcomes seems a bit irrealistic)? A vector of only the x% lowest values, for example?

Thanks in advance.