목차
없음
본문내용
3 / 2번 비교를 추가적으로 더 해아만 한다. 그러므로 총 n / 2 + n - 3 / 2 = 3n / 2 - 3 / 2번 비교를 한다.
2. If n is 4, draw Decision Tree about the algorithm 1.3.
int findMax(E, n)
1. max = E[0] ;
2. for (index = 1 ; index < n ; index++)
3. if (max < E[index])
4. max = E[index] ;
5. return max ;
▲ Solution
1
2
3
4
If n = 4
1 : 2
< >
2 : 3 1 : 3
< > < >
height = 3
3 : 4 2 : 4 3 : 4 1 : 4
< > < > < < >
4 3 4 2 4 3 4 1
2. If n is 4, draw Decision Tree about the algorithm 1.3.
int findMax(E, n)
1. max = E[0] ;
2. for (index = 1 ; index < n ; index++)
3. if (max < E[index])
4. max = E[index] ;
5. return max ;
▲ Solution
1
2
3
4
If n = 4
1 : 2
< >
2 : 3 1 : 3
< > < >
height = 3
3 : 4 2 : 4 3 : 4 1 : 4
< > < > < < >
4 3 4 2 4 3 4 1
소개글