# 前言

例如：常数O运行次数与N大小呈常数关系，即不随输入数据大小N的变化而变化。

# 例如：线性O循环运行次数与N大小呈线性关系，时间复杂度为O(N) 。

## 1.一般用C++怎么写：

``````int algorithm(int N){
int count=0;
for(int i=0;i<N;i++);
count++;
return count;
}
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import warnings warnings.filterwarnings('ignore') import ssl ssl._create_default_https_context = ssl._create_unverified_context ``````

## 2一般用Java怎么写：

``````int algorithm(int N){
int count=0;
for(int i=0;i<N;i++);
count++;
return count;
}
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import warnings warnings.filterwarnings('ignore') import ssl ssl._create_default_https_context = ssl._create_unverified_context ``````

# 1.一般会用C++写的程序为：

``````int algorithm(int N){
int a=1;
int b=2;
int x=a*b+N;
return 1;
}
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import warnings warnings.filterwarnings('ignore') import ssl ssl._create_default_https_context = ssl._create_unverified_context ```
```

## 2.一般会用java写的程序为：

``````int algorithm(int N){
int a=1;
int b=2;
int x=a*b+N;
return 1;
}
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import warnings warnings.filterwarnings('ignore') import ssl ssl._create_default_https_context = ssl._create_unverified_context ```
```

THE END