Optimization Topics/Exercise 04

From Wiki**3

< Optimization Topics
Revision as of 18:09, 2 June 2012 by Root (talk | contribs) (Created page with "Considere a seguinte função em C: <c> int find(int tab[], int max, int val) { int i; for (i = 0; i < max; i++) if (tab[i] == val) break; return i; } </c...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Considere a seguinte função em C: <c> int find(int tab[], int max, int val) {

 int i; 
 for (i = 0; i < max; i++) 
   if (tab[i] == val) 
     break; 
 return i; 

} </c>

  1. Identifique as optimizações independentes da máquina que são possíveis.
  2. Traduza para código Postfix optimizado a função acima.
  3. Identifique os blocos básicos.