Optimization Topics/Exercise 04: Difference between revisions

From Wiki**3

< Optimization Topics
(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...")
(No difference)

Revision as of 16:09, 2 June 2012

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.