If you're seeing this message, it means we're having trouble loading external resources on our website.

Jeżeli jesteś za filtrem sieci web, prosimy, upewnij się, że domeny *.kastatic.org i *.kasandbox.org są odblokowane.

Główna zawartość

Pomiar wydajności algorytmu


An online store manages an inventory of millions of products. On their front page, they show customers products related to the ones they've recently bought.
This procedure comes up with a list of similar products for a given list of products:
PROCEDURE findSimilarProducts(products) {
   similarProducts ← [] 
   FOR EACH product IN products {
     similarProduct ← calcSimilar(product)
     APPEND(similarProducts, similarProduct)
   RETURN similarProducts
The calcSimilar() procedure takes 2 minutes to return a result, as it needs to do a complicated series of database lookups and mathematic operations. The other operations, creating the empty list and appending items to the list, only take a few nanoseconds.
If the store calls the procedure on a list of 5 products, approximately how long will it take to complete?
Wybierz 1 odpowiedź:
Nie wiesz, jak rozwiązać to zadanie?
Nie wiesz, jak rozwiązać to zadanie?