Answers






Answers

20.1

  1. Basic strategy:

    RESULT := [];
    FOR EACH T IN TEAMS DO
       IF (T.TEAMNO > 1)
       AND (T.DIVISION = 'second') THEN
          RESULT :+ T;
    ENDFOR;
    

    Optimized strategy:

    RESULT := [];
    FOR EACH T IN TEAMS
    WHERE DIVISION = 'second' DO
       IF T.TEAMNO > 1 THEN
          RESULT :+ T;
    ENDFOR;
    
  2. Basic strategy:

    RESULT := [];
    FOR EACH P IN PLAYERS DO
       FOR EACH M IN MATCHES DO
          IF P.PLAYERNO = M.PLAYERNO AND
             P.BIRTH_DATE > '1963-01-01' THEN
             RESULT :+ P;
       ENDFOR;
    ENDFOR;
    

    Optimized strategy:

    RESULT := [];
    FOR EACH P IN PLAYERS
    WHERE P.BIRTH_DATE > '1963-01-01' DO
       FOR EACH M IN MATCHES DO
          IF P.PLAYERNO = M.PLAYERNO THEN
             RESULT :+ P;
       ENDFOR;
    ENDFOR;
    



 Python   SQL   Java   php   Perl 
 game development   web development   internet   *nix   graphics   hardware 
 telecommunications   C++ 
 Flash   Active Directory   Windows