Uitwerkingen_Februari_2012

0 for i 1 i n i val xi uxi u return

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: i; double val = 0.0; } for (i = 1; i <= n ; i++) { val += (x[i] – u)*(x[i] – u); } return val/n; Opgave 7 (8 punten) int tel_namen (struct burger *lijst, char *naam) { int aantal = 0; while (lijst) { if (strcmp (lijst -> voornaam, naam) == 0) { aantal++; } lijst = lijst -> volgend; } return (aantal); } Opgave 8 (8 punten) . void calculate_totals(int a[M][N], int b[N]) { int i, j, grand_total = 0; for (j = 0 ; j < N; j++) { b[j] = 0; for (i = 0 ; i < M ; i++) { b[j] += a[i][j]; } grand_total += b[j]; } return (grand_total); } Opgave 9 (10 punten) a. 14 2 20 8 6 3 17 28 19 24 6 b. int tree_sum (struct node * n) { if (n) { return (n -> data + tree_sum (n -> left) + tree_sum (n -> right)); } else return 0; }...
View Full Document

This note was uploaded on 02/04/2014 for the course EE 1710 taught by Professor Genderen during the Fall '13 term at Delft University of Technology.

Ask a homework question - tutors are online