Skip to content

Commit

Permalink
OK
Browse files Browse the repository at this point in the history
  • Loading branch information
thangved committed Oct 8, 2021
1 parent 7f5fc1b commit 4543580
Show file tree
Hide file tree
Showing 14 changed files with 762 additions and 479 deletions.
294 changes: 147 additions & 147 deletions .firebase/hosting.YnVpbGQ.cache

Large diffs are not rendered by default.

Binary file added docs/adts-queue/Queue-2-1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions docs/adts-queue/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ sidebar_position: 1

## Khái niệm

![queue](Queue-2-1.png)

:::info Khái niệm

`Hàng đợi` là một dạng danh sách đặc biệt. Mà thao tác thêm vào danh sách được thực hiện ở cuối danh sách, thao tác xóa thực hiện ở đầu danh sách.
Expand Down
2 changes: 1 addition & 1 deletion docs/algorithm-complexity/alorithm.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
sidebar_position: 2
---

# Giair thuật
# Giải thuật

## Khái niệm

Expand Down
43 changes: 27 additions & 16 deletions docs/algorithm-complexity/complexity.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ sidebar_position: 3

_Ví dụ:_

> Tính độ phức tạp của thuật toán `Sắp xếp sau:`
Tính độ phức tạp của thuật toán `Sắp xếp sau:`

```c
```c {3,5,6}
void sort(int A[])
{
int length = sizeof(A) / sizeof(int);
int length = sizeof(A) / sizeof(int); /*** O(1) ***/

for (int i = 0; i < length; i++) // O(n^2)
for (int j = i + 1; i < length; i++) // O(n)
for (int i = 0; i < length; i++) /*** O(n)*O(n) ***/
for (int j = i + 1; i < length; i++) /*** O(n) ***/
if (A[i] > A[j])
{
int t = A[i];
Expand All @@ -32,24 +32,35 @@ void sort(int A[])
}
```
> Độ phức tạp của giải thuật này là n^2.
:::info Cách tính
- Dòng **3**: Phép gán và tính toán số học có độ phức tạp là $O(1)$;
- Dòng **5**: Vòng lặp có độ phức tạp là $O(n) *$ **độ phức tạp của biểu thức trong vòng lặp**
- Dòng **6**: vòng lặp có độ phức tạp là $O(n) *$ **độ phức tạp của biểu thức trong vòng lặp**
- Dòng **7** đến **12**: Có độ phức tạp là $O(1)$
- Vòng lặp dòng **6** có độ phức tạp là $O(n)*1=O(n)$
- Vòng lặp dòng **5** có độ phức tạp là $O(n)*O(n)=O(n^2)$
$\rightarrow$ Độ phức tạp của giải thuật này là $O(n^2) + 1 = O(n^2)$.
:::
## Các dạng phức tạp thường gặp
| Dạng phức tạp | Hàm thể hiện độ phức tạp | Thời gian thực hiện |
| ------------- | ------------------------ | --------------------- |
| Hằng | | O(1) |
| Logarit | log(n) | O(log(n)) |
| Tuyến tính | n | O(n) |
| | n\*log(n) | O(n\*log(n)) |
| Bậc hai | n^2 | O(n^2) |
| Khối | n^3 | O(n^3) |
| Mũ | 2^n, n!, n^k | O(2^n), O(n!), O(n^k) |
| Dạng phức tạp | Hàm thể hiện độ phức tạp | Thời gian thực hiện |
| ------------- | ------------------------ | ----------------------- |
| Hằng | | $O(1)$ |
| Logarit | $log(n)$ | $O(log(n))$ |
| Tuyến tính | $n$ | $O(n)$ |
| | $n*log(n)$ | $O(n*log(n))$ |
| Bậc hai | $n^2$ | $O(n^2)$ |
| Khối | $n^3$ | $O(n^3)$ |
| Mũ | $2^n, n!, n^k$ | $O(2^n), O(n!), O(n^k)$ |
## Ví dụ
:::danger
[Click me 🔥](/pdf/vidu.pdf)
[Click me 🔥](./vidu.pdf)
:::
Binary file added docs/algorithm-complexity/vidu.pdf
Binary file not shown.
17 changes: 14 additions & 3 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const lightCodeTheme = require('prism-react-renderer/themes/github');
const darkCodeTheme = require('prism-react-renderer/themes/oceanicNext');
const darkCodeTheme = require('prism-react-renderer/themes/dracula');
const math = require('remark-math');
const katex = require('rehype-katex');
const path = require('path');

// With JSDoc @type annotations, IDEs can provide config autocompletion
Expand All @@ -14,7 +15,7 @@ module.exports = {
favicon: 'img/favicon.ico',
organizationName: 'thangved', // Usually your GitHub org/user name.
projectName: 'ctdlct177', // Usually your repo name.
themes: ['@docusaurus/theme-live-codeblock'],
themes: ['@docusaurus/theme-bootstrap', '@docusaurus/theme-live-codeblock'],
i18n: {
defaultLocale: 'vi-VN',
locales: ['vi-VN'],
Expand All @@ -34,6 +35,8 @@ module.exports = {
sidebarPath: require.resolve('./sidebars.js'),
// Please change this to your repo.
editUrl: 'https://github.com/thangved/datastructure',
remarkPlugins: [math],
rehypePlugins: [katex],
},
blog: {
showReadingTime: true,
Expand All @@ -46,6 +49,14 @@ module.exports = {
}),
],
],
stylesheets: [
{
href: 'https://cdn.jsdelivr.net/npm/katex@0.13.11/dist/katex.min.css',
integrity:
'sha384-Um5gpz1odJg5Z4HAmzPtgZKdTBHZdw8S29IecapCSB31ligYPhHQZMIlWLYQGVoc',
crossorigin: 'anonymous',
},
],

themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
Expand Down

1 comment on commit 4543580

@codefactor-io
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CodeFactor found multiple issues:

Unnecessary escape character: -.

'options' is defined but never used.

'context' is defined but never used.

Please sign in to comment.