-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.jsx
94 lines (89 loc) · 1.94 KB
/
index.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import React from "react";
import { Button, Table } from "antd";
import { t } from "../locales";
import "./index.less";
// | 数据规模 | 算法可接受时间复杂度 |
// | -------- | -------------------- |
// | <= 10 | $O(n!)$ |
// | <=20 | $O(2^n)$ |
// | <=100 | $O(n^4)$ |
// | <=500 | $O(n^3)$ |
// | <=2500 | $O(n^2)$ |
// | <=10^6 | $O(n * logn)$ |
// | <=10^7 | $O(n)$ |
// | <=10^14 | $O(\sqrt{n})$ |
// | - | $O(logn)$ |
const getColumns = () => [
{
key: "size",
dataIndex: "size",
// title: "数据规模",
title: t("Locale.complexityQuickCheck.dataScale"),
align: "center",
},
{
key: "complexity",
dataIndex: "complexity",
// title: "算法可接受时间复杂度",
title: t("Locale.complexityQuickCheck.timeComplexity"),
align: "center",
render: (t) => {
if (t === "O(sqrt(n))")
return <img alt="O(sqrt(n))" src={require("../imgs/sqrt.svg")} />;
return t;
},
},
];
const data = [
{
size: "<= 10",
complexity: "O(n!)",
},
{
size: "<= 20",
complexity: "O(2^n)",
},
{
size: "<= 100",
complexity: "O(n^4)",
},
{
size: "<= 500",
complexity: "O(n^3)",
},
{
size: "<= 2500",
complexity: "O(n^2)",
},
{
size: "<= 10^6",
complexity: "O(nlogn)",
},
{
size: "<= 10^7",
complexity: "n",
},
{
size: "<= 10^14",
complexity: "O(sqrt(n))",
},
{
size: "-",
complexity: "O(logn)",
},
];
export default function ComplexityRating() {
return (
<div>
<Button
type="link"
href="https://lucifer.ren/blog/2020/12/21/shuati-silu3/"
target="_blank"
>
{/* 不懂为什么?点这里 */}
{t("Locale.complexityQuickCheck.tips")}
</Button>
<Table columns={getColumns()} dataSource={data} />
</div>
);
}