From c6de3b692bf1b4030ee4b0fb5ad1e38636324213 Mon Sep 17 00:00:00 2001 From: Alex Hyett Date: Thu, 8 Dec 2022 12:13:53 +0000 Subject: [PATCH] Add Big O Notation Code --- .../Constant/Constant.csproj | 11 ++++++++ 2022-12-09-Big-O-Notation/Constant/Program.cs | 23 +++++++++++++++++ .../Exponential/Exponential.csproj | 11 ++++++++ .../Exponential/Program.cs | 21 ++++++++++++++++ .../Linear/Linear.csproj | 11 ++++++++ 2022-12-09-Big-O-Notation/Linear/Program.cs | 25 +++++++++++++++++++ .../Quadratic/Program.cs | 24 ++++++++++++++++++ .../Quadratic/Quadratic.csproj | 11 ++++++++ README.md | 1 + 9 files changed, 138 insertions(+) create mode 100644 2022-12-09-Big-O-Notation/Constant/Constant.csproj create mode 100644 2022-12-09-Big-O-Notation/Constant/Program.cs create mode 100644 2022-12-09-Big-O-Notation/Exponential/Exponential.csproj create mode 100644 2022-12-09-Big-O-Notation/Exponential/Program.cs create mode 100644 2022-12-09-Big-O-Notation/Linear/Linear.csproj create mode 100644 2022-12-09-Big-O-Notation/Linear/Program.cs create mode 100644 2022-12-09-Big-O-Notation/Quadratic/Program.cs create mode 100644 2022-12-09-Big-O-Notation/Quadratic/Quadratic.csproj diff --git a/2022-12-09-Big-O-Notation/Constant/Constant.csproj b/2022-12-09-Big-O-Notation/Constant/Constant.csproj new file mode 100644 index 0000000..0a53fc4 --- /dev/null +++ b/2022-12-09-Big-O-Notation/Constant/Constant.csproj @@ -0,0 +1,11 @@ + + + + Exe + net7.0 + Constant + disable + enable + + + diff --git a/2022-12-09-Big-O-Notation/Constant/Program.cs b/2022-12-09-Big-O-Notation/Constant/Program.cs new file mode 100644 index 0000000..2225b2d --- /dev/null +++ b/2022-12-09-Big-O-Notation/Constant/Program.cs @@ -0,0 +1,23 @@ +using System; + +namespace Constant +{ + internal class Program + { + static void Main(string[] args) + { + Console.WriteLine("Constant Example"); + Console.WriteLine("Another Line"); + Console.WriteLine("Another Line"); + Console.WriteLine("Another Line"); + + for (int i = 0; i < 10; i++) + { + Console.WriteLine(i); + } + } + } +} + + + diff --git a/2022-12-09-Big-O-Notation/Exponential/Exponential.csproj b/2022-12-09-Big-O-Notation/Exponential/Exponential.csproj new file mode 100644 index 0000000..4ddf2a8 --- /dev/null +++ b/2022-12-09-Big-O-Notation/Exponential/Exponential.csproj @@ -0,0 +1,11 @@ + + + + Exe + net7.0 + Exponential + disable + enable + + + diff --git a/2022-12-09-Big-O-Notation/Exponential/Program.cs b/2022-12-09-Big-O-Notation/Exponential/Program.cs new file mode 100644 index 0000000..ddcbf18 --- /dev/null +++ b/2022-12-09-Big-O-Notation/Exponential/Program.cs @@ -0,0 +1,21 @@ +using System; + +namespace Exponential +{ + internal class Program + { + static void Main(string[] args) + { + Console.WriteLine(fib(6)); + } + + static int fib(int num) + { + if (num <= 1) return num; + return fib(num - 2) + fib(num - 1); + } + } +} + + + diff --git a/2022-12-09-Big-O-Notation/Linear/Linear.csproj b/2022-12-09-Big-O-Notation/Linear/Linear.csproj new file mode 100644 index 0000000..04708b2 --- /dev/null +++ b/2022-12-09-Big-O-Notation/Linear/Linear.csproj @@ -0,0 +1,11 @@ + + + + Exe + net7.0 + Linear + disable + enable + + + diff --git a/2022-12-09-Big-O-Notation/Linear/Program.cs b/2022-12-09-Big-O-Notation/Linear/Program.cs new file mode 100644 index 0000000..17b62b2 --- /dev/null +++ b/2022-12-09-Big-O-Notation/Linear/Program.cs @@ -0,0 +1,25 @@ +using System; + +namespace Linear +{ + internal class Program + { + static void Main(string[] args) + { + var n = 10; + + for (int i = 0; i < n; i++) + { + Console.WriteLine(i); + } + + for (int i = 0; i < n; i++) + { + Console.WriteLine(i); + } + } + } +} + + + diff --git a/2022-12-09-Big-O-Notation/Quadratic/Program.cs b/2022-12-09-Big-O-Notation/Quadratic/Program.cs new file mode 100644 index 0000000..f4eeedd --- /dev/null +++ b/2022-12-09-Big-O-Notation/Quadratic/Program.cs @@ -0,0 +1,24 @@ +using System; + +namespace Quadratic +{ + internal class Program + { + static void Main(string[] args) + { + var n = 10; + + for (int i = 1; i <= n; i++) + { + for (int j = 1; j <= i; j++) + { + Console.Write("0 "); + } + Console.WriteLine(); + } + } + } +} + + + diff --git a/2022-12-09-Big-O-Notation/Quadratic/Quadratic.csproj b/2022-12-09-Big-O-Notation/Quadratic/Quadratic.csproj new file mode 100644 index 0000000..926ec16 --- /dev/null +++ b/2022-12-09-Big-O-Notation/Quadratic/Quadratic.csproj @@ -0,0 +1,11 @@ + + + + Exe + net7.0 + Quadratic + disable + enable + + + diff --git a/README.md b/README.md index 1edadb6..f2852b8 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ I will add new code as soon as I am done editing the videos. So, you might find | Date Published | Video | Link | | -------------- | ----------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- | +| 2022-12-09 | [Big O Notation](https://youtu.be/aIG48ldbpRI) | [code](2022-12-09-Big-O-Notation) | | 2022-11-25 | [Stack vs Heap](https://youtu.be/5OJRqkYbK-4) | [code](2022-11-25-Stack-Vs-Heap) | | 2022-11-11 | [Automate Your Life With Python (File Management Step By Step Example)](https://youtu.be/1dgnl7oCVTY) | [code](2022-11-11-Automate-Your-Life-With-Python/move-photos.py) | | 2022-10-21 | [Bitwise Operators and WHY we use them](https://youtu.be/igIjGxF2J-w) | [code](2022-10-21-Bitwise-Operators-and-WHY-we-use-them) |