diff --git a/content/Boolean Algebra/Boolean Algebra.md b/content/Boolean Algebra/Boolean Algebra.md deleted file mode 100644 index a12731e96..000000000 --- a/content/Boolean Algebra/Boolean Algebra.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -Author: - - Xinyang YU -Author Profile: - - https://linkedin.com/in/xinyang-yu -tags: - - boolean_algebra - - computer_organisation -Creation Date: 2023-10-17T09:37:33+08:00 -Last Date: 2023-10-17T09:37:33+08:00 -References: ---- - - - -## Terminologies ---- -### Commutativity -- The order of operands does not affect the outcome -### Associativity -- A set of operations can be grouped differently without changing outcome \ No newline at end of file diff --git a/content/Boolean Algebra/Boolean Function.md b/content/Boolean Algebra/Boolean Function.md new file mode 100644 index 000000000..be41cab5c --- /dev/null +++ b/content/Boolean Algebra/Boolean Function.md @@ -0,0 +1,22 @@ +--- +Author: + - Xinyang YU +Author Profile: + - https://linkedin.com/in/xinyang-yu +tags: + - boolean_algebra + - computer_organisation +Creation Date: 2023-08-20T16:09:31+08:00 +Last Date: 2023-12-23T00:22:53+08:00 +References: +--- +## Abstract +--- +- Use **Truth Table** to prove if 2 functions equal to each other +- The above function is X [[AND]] Y [[AND]] C +![[boolean functions.png]] + +## Complement Function +--- +- Given [[Boolean Function]] F, the complement is denoted as F', is obtained by interchanging 1 with 0 & 0 with 1 in the function's output values +- An [Example](https://chat.openai.com/share/f317b4c5-1b1c-4abf-b8e1-30c6ee185ba4) \ No newline at end of file diff --git a/content/Boolean Algebra/Boolean Standard Form.md b/content/Boolean Algebra/Boolean Standard Form.md new file mode 100644 index 000000000..ff66c3a21 --- /dev/null +++ b/content/Boolean Algebra/Boolean Standard Form.md @@ -0,0 +1,39 @@ +--- +Author: + - Xinyang YU +Author Profile: + - https://linkedin.com/in/xinyang-yu +tags: + - boolean_algebra + - computer_organisation +Creation Date: 2023-08-20T15:47:57+08:00 +Last Date: 2023-12-23T00:18:53+08:00 +References: +draft: +--- +## Abstract +--- +- When it is expressed in [[#Sum-of-Products (SOP)]] or [[#Product-of-Sums (POS)]] + + + + +## Terminologies +--- +### Boolean Variable +- A variables that hold either ``true`` or ``false`` + +### Boolean Literal +- A [[#Boolean Variable]] on its own or its complemented form + +### Sum Term +- A single [[#Boolean Literal]] or a [[OR]] of multiple Boolean Literals + +### Product Term +- A single [[#Boolean Literal]] or a [[AND]] of several Boolean Literals + +### Product-of-Sums (POS) +- A single [[#Sum Term]] or [[AND]] of multiple Sum Term + +### Sum-of-Products (SOP) +- A [[#Product Term]] or a [[OR]] of multiple Product Term \ No newline at end of file diff --git a/content/Boolean Algebra/Functions/Boolean Functions.md b/content/Boolean Algebra/Functions/Boolean Functions.md deleted file mode 100644 index 4f18899d1..000000000 --- a/content/Boolean Algebra/Functions/Boolean Functions.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -Author: - - Xinyang YU -Author Profile: - - https://linkedin.com/in/xinyang-yu -tags: - - boolean_algebra - - computer_organisation -Creation Date: 2023-08-20T16:08:47+08:00 -Last Date: 2023-08-20T16:08:47+08:00 -References: ---- - ->[!note] Use [[Truth Table]] to prove if 2 functions equal to each other ->![[boolean functions.png]] ->- The above function is X [[Logical Product (AND)]] Y [[Logical Product (AND)]] C \ No newline at end of file diff --git a/content/Boolean Algebra/Functions/Complement Function.md b/content/Boolean Algebra/Functions/Complement Function.md deleted file mode 100644 index 77ddb0594..000000000 --- a/content/Boolean Algebra/Functions/Complement Function.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -Author: - - Xinyang YU -Author Profile: - - https://linkedin.com/in/xinyang-yu -tags: - - boolean_algebra - - computer_organisation -Creation Date: 2023-08-20T16:09:31+08:00 -Last Date: 2023-08-20T16:09:31+08:00 -References: ---- ->[!abstract] Given [[Boolean Functions]] F, the complement is denoted as F', is obtained by interchanging 1 with 0 & 0 with 1 in the function's output values ->- [Example](https://chat.openai.com/share/f317b4c5-1b1c-4abf-b8e1-30c6ee185ba4) \ No newline at end of file diff --git a/content/Boolean Algebra/Logic Gates/Logical Product (AND).md b/content/Boolean Algebra/Logic Gates/AND.md similarity index 69% rename from content/Boolean Algebra/Logic Gates/Logical Product (AND).md rename to content/Boolean Algebra/Logic Gates/AND.md index 8679ce781..4800e16ad 100644 --- a/content/Boolean Algebra/Logic Gates/Logical Product (AND).md +++ b/content/Boolean Algebra/Logic Gates/AND.md @@ -7,14 +7,17 @@ tags: - boolean_algebra - computer_organisation Creation Date: 2023-09-21T13:26:58+08:00 -Last Date: 2023-09-21T13:26:58+08:00 -References: +Last Date: 2023-12-23T00:23:48+08:00 +References: --- ## Abstract --- +- Logical Product - Made of 2 [[Transistors (晶体管)]] ![[AND.png]] ->[!note] Represented ->$$A\times B$$ ->Or ->$$AB$$ \ No newline at end of file + +- Represented by + +$$A\times B$$ + +$$AB$$ \ No newline at end of file diff --git a/content/Boolean Algebra/Logic Gates/NOT Gate.md b/content/Boolean Algebra/Logic Gates/NOT.md similarity index 75% rename from content/Boolean Algebra/Logic Gates/NOT Gate.md rename to content/Boolean Algebra/Logic Gates/NOT.md index 44624b247..8b2f420ef 100644 --- a/content/Boolean Algebra/Logic Gates/NOT Gate.md +++ b/content/Boolean Algebra/Logic Gates/NOT.md @@ -7,13 +7,13 @@ tags: - boolean_algebra - computer_organisation Creation Date: 2023-09-21T13:27:34+08:00 -Last Date: 2023-09-21T13:27:34+08:00 -References: +Last Date: 2023-12-23T00:26:18+08:00 +References: --- ## Abstract --- - Made of 1 [[Transistors (晶体管)]] ![[NOT.png]] ->! ->[!note] Represented ->$$X'$$ \ No newline at end of file + +- Represented by +$$X'$$ \ No newline at end of file diff --git a/content/Boolean Algebra/Logic Gates/Logical Sum (OR).md b/content/Boolean Algebra/Logic Gates/OR.md similarity index 74% rename from content/Boolean Algebra/Logic Gates/Logical Sum (OR).md rename to content/Boolean Algebra/Logic Gates/OR.md index abd8b2e67..c22008c42 100644 --- a/content/Boolean Algebra/Logic Gates/Logical Sum (OR).md +++ b/content/Boolean Algebra/Logic Gates/OR.md @@ -7,20 +7,21 @@ tags: - boolean_algebra - computer_organisation Creation Date: 2023-11-24T18:38:25+08:00 -Last Date: 2023-11-24T18:38:25+08:00 -References: +Last Date: 2023-12-23T00:25:22+08:00 +References: --- ## Abstract --- +- Logical Sum - Made of 2 [[Transistors (晶体管)]] ![[OR.png]] ->[!note] Represented ->$$A+B$$ +- Represented by +$$A+B$$ ## Use Cases --- ### Turn on Low-level Flags -- Low-level things like [[Interrupts (中断)]] is represented in one bit, different [[Interrupts (中断)]] has different bit +- Low-level things like [[Interrupts (中断)]] is represented in one bit, different Interrupts (中断) has different bit - We can use the *OR Gate* on the current status and the flags we want to turn on \ No newline at end of file diff --git a/content/Boolean Algebra/Logic Gates/XOR (Exclusive OR) Gate.md b/content/Boolean Algebra/Logic Gates/XOR.md similarity index 75% rename from content/Boolean Algebra/Logic Gates/XOR (Exclusive OR) Gate.md rename to content/Boolean Algebra/Logic Gates/XOR.md index d9ddaea66..ff92248d7 100644 --- a/content/Boolean Algebra/Logic Gates/XOR (Exclusive OR) Gate.md +++ b/content/Boolean Algebra/Logic Gates/XOR.md @@ -7,14 +7,24 @@ tags: - boolean_algebra - computer_organisation Creation Date: 2023-09-21T10:01:00 -Last Date: 2023-12-15T12:01:10+08:00 +Last Date: 2023-12-23T00:28:33+08:00 References: --- ## Abstract --- +- *Exclusive OR* - Returns true only when 2 inputs aren't the same ![[XOR.png]] +## Properties +--- +### Self-Inverse +- `a ^ a = 0` +- `a` [[XOR]] `a` is always 0 +### Own-Inverse +- `a ^ b ^ b = a` +- W always get back the another half by [[XOR]] the another half one more time. Because [[#Self-Inverse]], `b ^ b = 0` + ## Tricks --- ### Swapping values @@ -34,11 +44,3 @@ public class MyClass { } ``` - -## Terminologies ---- -### Self-Inverse -- `a ^ a = 0` -### Own-Inverse -- `a ^ b ^ b = a` -- Because [[#Self-Inverse]], `b ^ b = 0` \ No newline at end of file diff --git a/content/Boolean Algebra/Minterms and Maxterms/Maxterm.md b/content/Boolean Algebra/Minterms and Maxterms/Maxterm.md index 6a285cb6a..2e1713911 100644 --- a/content/Boolean Algebra/Minterms and Maxterms/Maxterm.md +++ b/content/Boolean Algebra/Minterms and Maxterms/Maxterm.md @@ -7,10 +7,12 @@ tags: - boolean_algebra - computer_organisation Creation Date: 2023-08-20T15:56:23+08:00 -Last Date: 2023-08-20T15:56:23+08:00 -References: +Last Date: 2023-12-23T00:16:14+08:00 +References: --- ->[!abstract] A [[Sum Term]] that contains n [[Boolean Literals]] from all the [[Boolean Variables]] ->![[Minterms and Maxterms.png]] +## Abstract +--- +- A [[Boolean Standard Form#Sum Term]] that contains n [[Boolean Standard Form#Boolean Literal]] from all the [[Boolean Standard Form#Boolean Variable]] +- Denoted M0 to M[2^n-1] +![[Minterms and Maxterms.png]] ->[!note] Denoted M0 to M[2^n-1] \ No newline at end of file diff --git a/content/Boolean Algebra/Minterms and Maxterms/Minterm.md b/content/Boolean Algebra/Minterms and Maxterms/Minterm.md index 1ceb6edff..337b66c46 100644 --- a/content/Boolean Algebra/Minterms and Maxterms/Minterm.md +++ b/content/Boolean Algebra/Minterms and Maxterms/Minterm.md @@ -7,10 +7,11 @@ tags: - boolean_algebra - computer_organisation Creation Date: 2023-08-20T15:58:24+08:00 -Last Date: 2023-08-20T15:58:24+08:00 -References: +Last Date: 2023-12-23T00:18:10+08:00 +References: --- ->[!abstract] A [[Product Term]] that contains n [[Boolean Literals]] from all the [[Boolean Variables]] ->![[Minterms and Maxterms.png]] - ->[!note] Denoted m0 to m[2^n-1] \ No newline at end of file +## Abstract +--- +- A [[Boolean Standard Form#Product Term]] that contains n [[Boolean Standard Form#Boolean Literal]] from all the [[Boolean Standard Form#Boolean Variable]] +- Denoted by m0 to m[2^n-1] +![[Minterms and Maxterms.png]] diff --git a/content/Boolean Algebra/Standard Forms/Boolean Literals.md b/content/Boolean Algebra/Standard Forms/Boolean Literals.md deleted file mode 100644 index 80193aedf..000000000 --- a/content/Boolean Algebra/Standard Forms/Boolean Literals.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -Author: - - Xinyang YU -Author Profile: - - https://linkedin.com/in/xinyang-yu -tags: - - boolean_algebra - - computer_organisation -Creation Date: 2023-08-20T15:43:50+08:00 -Last Date: 2023-08-20T15:43:50+08:00 -References: ---- ->[!abstract] A [[Boolean Variables]] on its own or its complemented form \ No newline at end of file diff --git a/content/Boolean Algebra/Standard Forms/Boolean Variables.md b/content/Boolean Algebra/Standard Forms/Boolean Variables.md deleted file mode 100644 index 8aae4c273..000000000 --- a/content/Boolean Algebra/Standard Forms/Boolean Variables.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -Author: - - Xinyang YU -Author Profile: - - https://linkedin.com/in/xinyang-yu -tags: - - computer_organisation - - computer_organisation -Creation Date: 2023-08-20T15:42:31+08:00 -Last Date: 2023-08-20T15:42:31+08:00 -References: ---- ->[!abstract] A variables that hold either ``true`` or ``false`` \ No newline at end of file diff --git a/content/Boolean Algebra/Standard Forms/Product Term.md b/content/Boolean Algebra/Standard Forms/Product Term.md deleted file mode 100644 index 1abb5d637..000000000 --- a/content/Boolean Algebra/Standard Forms/Product Term.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -Author: - - Xinyang YU -Author Profile: - - https://linkedin.com/in/xinyang-yu -tags: - - boolean_algebra - - computer_organisation -Creation Date: 2023-08-20T15:45:30+08:00 -Last Date: 2023-08-20T15:45:30+08:00 -References: ---- ->[!abstract] A single [[Boolean Literals]] or a [[Logical Product (AND)]] of several [[Boolean Literals]] \ No newline at end of file diff --git a/content/Boolean Algebra/Standard Forms/Product-of-Sums (POS) Expression.md b/content/Boolean Algebra/Standard Forms/Product-of-Sums (POS) Expression.md deleted file mode 100644 index d697f9c05..000000000 --- a/content/Boolean Algebra/Standard Forms/Product-of-Sums (POS) Expression.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -Author: - - Xinyang YU -Author Profile: - - https://linkedin.com/in/xinyang-yu -tags: - - boolean_algebra - - computer_organisation -Creation Date: 2023-08-20T15:49:01+08:00 -Last Date: 2023-08-20T15:49:01+08:00 -References: ---- ->[!abstract] A single [[Sum Term]] or [[Logical Product (AND)]] of multiple [[Sum Term]] -> \ No newline at end of file diff --git a/content/Boolean Algebra/Standard Forms/Sum Term.md b/content/Boolean Algebra/Standard Forms/Sum Term.md deleted file mode 100644 index e7a6ba64d..000000000 --- a/content/Boolean Algebra/Standard Forms/Sum Term.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -Author: - - Xinyang YU -Author Profile: - - https://linkedin.com/in/xinyang-yu -tags: - - boolean_algebra - - computer_organisation -Creation Date: 2023-08-20T15:46:24+08:00 -Last Date: 2023-08-20T15:46:24+08:00 -References: ---- ->[!abstract] A single [[Boolean Literals]] or a [[Logical Sum (OR)]] of mutiple [[Boolean Literals]] \ No newline at end of file diff --git a/content/Boolean Algebra/Standard Forms/Sum-of-Products (SOP) Expression.md b/content/Boolean Algebra/Standard Forms/Sum-of-Products (SOP) Expression.md deleted file mode 100644 index c92dd9ebe..000000000 --- a/content/Boolean Algebra/Standard Forms/Sum-of-Products (SOP) Expression.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -Author: - - Xinyang YU -Author Profile: - - https://linkedin.com/in/xinyang-yu -tags: - - boolean_algebra - - computer_organisation -Creation Date: 2023-08-20T15:47:57+08:00 -Last Date: 2023-08-20T15:47:57+08:00 -References: ---- ->[!abstract] A [[Product Term]] or a [[Logical Sum (OR)]] of multiple [[Product Term]] \ No newline at end of file diff --git a/content/C/C Keywords.md b/content/C/C Keywords.md index 9d423b5e0..449ada2bd 100644 --- a/content/C/C Keywords.md +++ b/content/C/C Keywords.md @@ -6,15 +6,15 @@ Author Profile: tags: - c Creation Date: 2023-11-26T17:42:00 -Last Date: 2023-12-16T20:21:04+08:00 +Last Date: 2023-12-22T23:57:03+08:00 References: --- ## Abstract --- +- Keywords that may change the behaviours of [[Language Processors#Compiler]] or program - -### `volatile` +### `volatile {:c}` - Used to indicate to the [[Language Processors#Compiler]] that a variable's value may change unexpectedly - Often the case when a variable is being accessed by multiple [[Thread]] or when it represents *hardware* that is external to the computer - Compiler will not optimize the code that accesses the variable. This means that the compiler *will not reorder instructions or eliminate redundant reads or writes to the variable* @@ -37,5 +37,18 @@ uartinit(void) } ``` -### `asm volatile` -- Used to insert [[Assembly language]] directly into C code \ No newline at end of file +### `asm volatile {:c}` +- Used to insert [[Assembly language]] directly into C code +- Below example is [[Interrupts (中断)#Turn off interrupt in XV6-RISCV]] + +```c {7} +// XV6-RISCV kernel codes, riscv.h + +// ... +static inline void +w_sstatus(uint64 x) +{ + asm volatile("csrw sstatus, %0" : : "r" (x)); +} +// .. +``` \ No newline at end of file diff --git a/content/C/C Macro.md b/content/C/C Macro.md index 907c59890..b8f148071 100644 --- a/content/C/C Macro.md +++ b/content/C/C Macro.md @@ -5,23 +5,15 @@ Author Profile: - https://linkedin.com/in/xinyang-yu tags: - c -Creation Date: 2023-09-08T18:16:43+08:00 -Last Date: 2023-12-16T20:21:54+08:00 +Creation Date: 2023-09-08T18:14:42+08:00 +Last Date: 2023-12-22T23:48:29+08:00 References: --- ## Abstract --- - [[Language Processors#Preprocessor]] replaces the [[Macro]] with the value before passing to the [[Language Processors#Compiler]] - -## Benefits ---- -- Saving memory of using variables to store the values - - -## Example ---- -```c +```c {2} {11} #include #define PI 3.1415 @@ -37,4 +29,32 @@ int main() printf("Area=%.2f",area); return 0; } -``` \ No newline at end of file +``` + +## Function-like Macro +--- +Not same as [[Functions]], doesn't have [[Type Safety]] + +```c {3} {10} +#include +#define PI 3.1415 +#define circleArea(r) (PI*r*r) + +int main() { + float radius, area; + + printf("Enter the radius: "); + scanf("%f", &radius); + area = circleArea(radius); + printf("Area = %.2f", area); + + return 0; +} +``` + +## Benefits +--- +- Saving memory of using variables to store the values + + + diff --git a/content/C/C Terminologies.md b/content/C/C Terminologies.md new file mode 100644 index 000000000..7682aabe2 --- /dev/null +++ b/content/C/C Terminologies.md @@ -0,0 +1,19 @@ +--- +Author: + - Xinyang YU +Author Profile: + - https://linkedin.com/in/xinyang-yu +tags: + - c +Creation Date: 2023-12-22, 23:53 +Last Date: 2023-12-22T23:54:36+08:00 +References: +draft: +--- +## Abstract +--- + +| Terminology | Meaning | +| ----------- | ------- | +| C Vector | Basically [[Dynamic Array (List)]] | +| C Structs | Allow grouping of heterogenous data | diff --git a/content/C/C Vector.md b/content/C/C Vector.md deleted file mode 100644 index 7b16334cc..000000000 --- a/content/C/C Vector.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -Author: - - Xinyang YU -Author Profile: - - https://linkedin.com/in/xinyang-yu -tags: - - c -Creation Date: 2023-09-10T16:10:59+08:00 -Last Date: 2023-09-10T16:10:59+08:00 -References: ---- -## Abstract ---- -- Basically [[Dynamic Array (List)]] \ No newline at end of file diff --git a/content/C/C.md b/content/C/C.md deleted file mode 100644 index 1e4790897..000000000 --- a/content/C/C.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -Author: - - Xinyang YU -Author Profile: - - https://linkedin.com/in/xinyang-yu -tags: - - c -Creation Date: 2023-09-10T16:31:24+08:00 -Last Date: 2023-09-10T16:31:24+08:00 -References: ---- -## Abstract ---- - - - -## [[System Call (系统调用)]] ---- -- C provides [[Library Call]] that acts as a wrapper to make the [[System Call (系统调用)]] \ No newline at end of file diff --git a/content/C/Function-like Macro.md b/content/C/Function-like Macro.md deleted file mode 100644 index fb2d53887..000000000 --- a/content/C/Function-like Macro.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -Author: - - Xinyang YU -Author Profile: - - https://linkedin.com/in/xinyang-yu -tags: - - c -Creation Date: 2023-09-08T18:14:42+08:00 -Last Date: 2023-09-08T18:14:42+08:00 -References: ---- -## Abstract ---- -* Not same as [[Functions]], doesn't have [[Type Safety]] - - -## Example ---- -```c -#include -#define PI 3.1415 -#define circleArea(r) (PI*r*r) - -int main() { - float radius, area; - - printf("Enter the radius: "); - scanf("%f", &radius); - area = circleArea(radius); - printf("Area = %.2f", area); - - return 0; -} -``` \ No newline at end of file diff --git a/content/C/Structs (Structure).md b/content/C/Structs (Structure).md deleted file mode 100644 index cb6e2b281..000000000 --- a/content/C/Structs (Structure).md +++ /dev/null @@ -1,13 +0,0 @@ ---- -Author: - - Xinyang YU -Author Profile: - - https://linkedin.com/in/xinyang-yu -tags: - - c -Creation Date: 2023-08-18T20:39:29+08:00 -Last Date: 2023-08-18T20:39:29+08:00 -References: ---- ->[!abstract] ->- Allow grouping of heterogenous data \ No newline at end of file diff --git a/content/C/Void Pointer.md b/content/C/Void Pointer.md index 85a615226..57181f6e2 100644 --- a/content/C/Void Pointer.md +++ b/content/C/Void Pointer.md @@ -6,10 +6,10 @@ Author Profile: tags: - c Creation Date: 2023-10-04T17:02:00 -Last Date: 2023-12-14T18:16:44+08:00 +Last Date: 2023-12-22T23:49:43+08:00 --- ## Abstract --- -- A [[Pointer]] without type aka a pre-defined size +- A Pointer without type aka a pre-defined size - Used when we aren't sure what the exact size of a variable like the return type of [[malloc]] - We should always try to cast it to a *type* whenever it is possible \ No newline at end of file diff --git a/content/Computer Organisation/Circuit Design/Working Backward.md b/content/Computer Organisation/Circuit Design/Working Backward.md index 57a267f31..ae73d5082 100644 --- a/content/Computer Organisation/Circuit Design/Working Backward.md +++ b/content/Computer Organisation/Circuit Design/Working Backward.md @@ -16,5 +16,5 @@ References: >[!note] Processes (Simple but uses a lot of [[Gates]], can be reduce [[Gates]] with the use of [[Karnaugh Map]]) >1. Come up with a [[Truth Table]] first ->2. For each true records, we connect the inputs using [[Logical Product (AND)]] gates ->3. We connect true record [[Logical Product (AND)]] gates with [[Logical Sum (OR)]] gates \ No newline at end of file +>2. For each true records, we connect the inputs using [[AND]] gates +>3. We connect true record [[AND]] gates with [[OR]] gates \ No newline at end of file diff --git a/content/Computer Organisation/Circuits/Combination Circuit/Half Adder.md b/content/Computer Organisation/Circuits/Combination Circuit/Half Adder.md index 3376dde85..b68f6a7e0 100644 --- a/content/Computer Organisation/Circuits/Combination Circuit/Half Adder.md +++ b/content/Computer Organisation/Circuits/Combination Circuit/Half Adder.md @@ -11,5 +11,5 @@ References: --- ## Abstract --- -- Built with 1 [[XOR (Exclusive OR) Gate]] for the current bit & 1 [[Logical Product (AND)]] for the carry bit +- Built with 1 [[XOR]] for the current bit & 1 [[AND]] for the carry bit - Takes in 2 [[Computer Data Representation#Bit]] \ No newline at end of file diff --git a/content/Computer Organisation/Instruction Set Architecture (ISA)/MIPS/MIPS I-Type Instruction.md b/content/Computer Organisation/Instruction Set Architecture (ISA)/MIPS/MIPS I-Type Instruction.md index 470759dce..1e78767b5 100644 --- a/content/Computer Organisation/Instruction Set Architecture (ISA)/MIPS/MIPS I-Type Instruction.md +++ b/content/Computer Organisation/Instruction Set Architecture (ISA)/MIPS/MIPS I-Type Instruction.md @@ -18,7 +18,7 @@ References: ## Examples --- ### `andi` -- Perform a bitwise [[Logical Product (AND)]] operation between a register and an immediate value +- Perform a bitwise [[AND]] operation between a register and an immediate value - Get last 4 significant [[Computer Data Representation#Bit]] of $s0, and store it inside $t0 - `andi $t0, $s0 , 0xF` ### `slti` diff --git a/content/Discrete Math/Set.md b/content/Discrete Math/Set.md index 1d05840c4..795640652 100644 --- a/content/Discrete Math/Set.md +++ b/content/Discrete Math/Set.md @@ -6,7 +6,7 @@ Author Profile: tags: - discrete_math Creation Date: 2023-12-18, 10:33 -Last Date: 2023-12-21T10:02:37+08:00 +Last Date: 2023-12-22T18:04:21+08:00 References: --- ## Abstract @@ -101,6 +101,12 @@ $$ $$ \{\} $$ +$$ +\emptyset \not\in \{\} +$$ +$$ +\emptyset \subseteq \{\} +$$ - A [[Discrete Math/Set|Set]] that contains `0` [[#Object]] - Itself is a [[#Object]] >[!caution] Not a **Null Set** diff --git a/content/Linux/Bash/scp.md b/content/Linux/Networking/scp.md similarity index 97% rename from content/Linux/Bash/scp.md rename to content/Linux/Networking/scp.md index 23d5b5cea..2c6712ade 100644 --- a/content/Linux/Bash/scp.md +++ b/content/Linux/Networking/scp.md @@ -4,7 +4,7 @@ Author: Author Profile: - https://linkedin.com/in/xinyang-yu tags: - - bash + - linux Creation Date: 2023-08-07T16:32:55+08:00 Last Date: 2023-08-07T16:32:55+08:00 References: diff --git "a/content/Number Theory/Prime Number (\350\264\250\346\225\260).md" "b/content/Number Theory/Prime Number (\350\264\250\346\225\260).md" index df5313206..ce322c9d0 100644 --- "a/content/Number Theory/Prime Number (\350\264\250\346\225\260).md" +++ "b/content/Number Theory/Prime Number (\350\264\250\346\225\260).md" @@ -6,7 +6,7 @@ Author Profile: tags: - number_theory Creation Date: 2023-12-15, 15:53 -Last Date: 2023-12-18T20:40:42+08:00 +Last Date: 2023-12-22T18:36:34+08:00 References: --- ## Abstract @@ -14,14 +14,28 @@ References: - An *positive integer* whose divisor is `1` and itself, and itself cant be `1` - 2 is the smallest prime number - We can check if an integer is prime by checking if it has any divisor that is between 2 and itself + +## Trial Division Method +--- +Verifying if an [[Integer (整数)]] is a [[Prime Number (质数)]] in `O(sqrt(n))` + ```java -// Time Complexity - O(n), where n is the size of the integer -public static boolean isPrime(int n) { - for (int i=3; i `4 = 1*4`, `8 = 2*4` - Given `[1,13,5]`, the differences we have are `12` and `8`, the GCD of `12` and `8` is `4` -> `12 = 3*4`, `8 = 2*4` +- The order doesn't matter since eventually all elements should be reduced to the same integer - We can make the difference is positive, to ensure the GCD calculated is positive ## Space & Time Analysis --- diff --git a/content/cp/Square Difference.md b/content/cp/Square Difference.md new file mode 100644 index 000000000..c7d4d1245 --- /dev/null +++ b/content/cp/Square Difference.md @@ -0,0 +1,58 @@ +--- +sthNew: true +Mastery Level: + - 📕 +Time Taken: +Space: + - O(n) +Time: O(n) +Appears On: + - Codeforces +Brush: 1 +Difficulty: + - "1000" +Area: + - data structure +Reference 1: +Reference 2: +Author: + - Xinyang YU +Author Profile: + - https://linkedin.com/in/xinyang-yu +Creation Date: 2023-12-22, 17:58 +Last Date: 2023-12-22T17:59:00+08:00 +tags: + - cp +draft: "true" +--- +[Original Problem]() +## Idea +--- +- The idea here is + + +## Space & Time Analysis +--- +The analysis method we are using is [[Algorithm Complexity Analysis]] +### Space - O() +- *Ignore input size & language dependent space* +- +### Time - O() +- + + +## Codes +--- +### 1st Attempt (Java) +```java + +``` + +## Personal Reflection +--- +- **Why it takes so long to solve:** *NIL* +- **What you could have done better:** *NIL* +- **What you missed:** *NIL* +- **Ideas you've seen before:** *NIL* +- **Ideas you found here that could help you later:** *NIL* +- **Ideas that didn't work and why:** *NIL* \ No newline at end of file