def bubble_sort(arr):
    n = len(arr)
    for i in range(n - 1):
        for j in range(n - i - 1):
            if arr[j] > arr[j + 1]:
                arr[j], arr[j + 1] = arr[j + 1], arr[j]

# 测试示例
arr = [64, 34, 25, 12, 22, 11, 90]
bubble_sort(arr)
print("排序后的数组：")
for i in range(len(arr)):
    print(arr[i], end=" ")
import numpy as np
import matplotlib.pyplot as plt

# 生成 x 值
x = np.linspace(0, 2 * np.pi, 100)

# 计算正弦函数值
y = np.sin(x)

# 绘制图形
plt.plot(x, y)
plt.xlabel('x')
plt.ylabel('sin(x)')
plt.title('Sine Function')
plt.grid(True)
plt.show()
import numpy as np
import matplotlib.pyplot as plt

# 生成 x 值
x = np.linspace(0, 2 * np.pi, 100)

# 计算正弦函数值
y = np.sin(x)

# 绘制图形
plt.plot(x, y)
plt.xlabel('x')
plt.ylabel('sin(x)')
plt.title('Sine Function')
plt.grid(True)
plt.show()
