Computer Science Canada big-oh notation |
Author: | rickdragon [ Tue Jan 13, 2004 9:18 pm ] |
Post subject: | big-oh notation |
/* Give using "big-oh" notation, the worst case running time of following procedure as a function of n int recursive(int n) { if(n<=1) return 1; else return(recursive(n-1)+recursive(n-1)); } */ #include<stdio.h> #include<conio.h> void main() { int n; clrscr(); puts("Enter n :"); scanf("%d",&n); printf("A = %d",recursive(n)); getch(); } int recursive(int n) { if(n<=1) return 1; else return(recursive(n-1)+recursive(n-1)); } |
Author: | McKenzie [ Wed Jan 14, 2004 11:31 am ] |
Post subject: | |
Are you asking for someone to give the big O notation (i.e. as sort of a helpfull little quiz?), or are you claiming that your program gives big O notation? If it is the first, cool, I won't answer it, and spoil everyone's fun but if it is the second your program does not quite solve the problem |