Академический Документы
Профессиональный Документы
Культура Документы
N^2
N^3
2^N
Nlog2N
log2N
RtN
16
64
16
16
16
256
4096
65536
64
256
64
4096
262144 1.8447E+1
9
384
4096
256
65536
16777216 1.1579E+7
7
2048
16
65536
512
262144
13427728 NaN
4608
9 16rt2
QUESTION 6.
a). F3 <=F2 <= F1 <= F4.
F2 has the smallest growth rate while F4 has the highest growth rate.
b). In the increasing order of complexity is as follows : F1, F4, F3, F2.
F2 has the fastest growth rate while F1 has the slowest growth rate.
QUESTION 7.
The complexity of the algorithm is O(nsq)
262144
QUESTION 8.
The algorithm of the complexity is O(log n).
QUESTION 9.
#include<stdio.h>
#include<stdbool.h>
#define SIZE 8
bool search(int needle, int haystack [], int size)
{
for (int = 0; i < size ; i++)
{
if( needle == haystack [i])
return true;
}
int main (void)
{
int numbers { SIZE } = [ 4, 8, 15, 16, 23, 42, 50, 108 ]
printf(Enter the number to search);
int n;
scanf(%d, &n);
if ( search(n, numbers, SIZE))
printf(The number has been found\n);
else
printf(The number has NOT been found\n);
return 0;