algos/py/week_1_set_1.py

51 lines
831 B
Python

import matplotlib.pyplot as plt
import numpy as np
n = np.arange(1, 1000, 1)
# Version 1
a = 2**np.log(n)
b = 2**2**np.log(n)
c = n**(5/2)
d = 2**n**2
e = (n**2)*np.log(n)
# plt.plot(n, a, 'b', n, b, 'y') # a < b
# plt.plot(n, b, 'b', n, c, 'y') # b > c
# plt.plot(n, a, 'b', n, c, 'y') # a < c
# plt.plot(n, c, 'b', n, d, 'y') # c << d
# plt.plot(n, c, 'b', n, e, 'y') # c > e
# plt.plot(n, e, 'b', n, b, 'y') # e < b
# plt.plot(n, e, 'b', n, a, 'y') # e > a
# a < e < c < b < d
n = np.arange(1, 1000, 1)
# n = 1000
a = np.sqrt(n)
b = 10**n
c = n**1.5
d = 2**np.sqrt(np.log(n))
e = n**5/3
# print(a, b, c, d, e)
# d < a < c < e < b
# print(d < a, a < c, c < e, e < b)
plt.plot(n, a, 'b', n, d, 'y') # a > d
plt.show()
"""
1) n*log(n)
2) True
3) Yes if and Sometimes yes
4) O(nk**2)
5) :/ Tried:
ecadb
abecd
"""