├── .obsidian ├── hotkeys.json ├── app.json ├── appearance.json ├── core-plugins.json ├── core-plugins-migration.json └── workspace.json ├── DSA ├── .obsidian │ ├── hotkeys.json │ ├── app.json │ ├── appearance.json │ ├── desktop.ini │ ├── core-plugins.json │ ├── core-plugins-migration.json │ └── workspace.json ├── Notes │ ├── desktop.ini │ ├── 01_Algorithm_Complexity.md │ ├── 03_Algorithms.md │ ├── 02_Data_Structure.md │ └── 04_Advanced_Topics.md ├── desktop.ini ├── Roadmap (DSA).md └── C++ Data Structures and Algorithms Cheat Sheet.md ├── Languages ├── C# │ ├── Codes │ │ ├── Basics.cs │ │ └── desktop.ini │ ├── .obsidian │ │ ├── hotkeys.json │ │ ├── app.json │ │ ├── appearance.json │ │ ├── desktop.ini │ │ ├── core-plugins.json │ │ ├── core-plugins-migration.json │ │ └── workspace.json │ ├── desktop.ini │ └── Notes │ │ ├── desktop.ini │ │ ├── 07_Graphical_User_Interface_(GUI).md │ │ ├── 04_Exception_Handling.md │ │ ├── 05_Collections_and_Generics.md │ │ ├── 06_File_Input_Output.md │ │ ├── 02_Functions_and_Methods.md │ │ ├── 03_Object_Orinted_Programming.md │ │ ├── 08_Advanced_Topics.md │ │ └── 01_Basic_Concepts.md ├── .obsidian │ ├── app.json │ ├── hotkeys.json │ ├── appearance.json │ ├── desktop.ini │ ├── core-plugins.json │ ├── graph.json │ ├── core-plugins-migration.json │ └── workspace.json ├── C++ │ ├── .obsidian │ │ ├── hotkeys.json │ │ ├── app.json │ │ ├── appearance.json │ │ ├── desktop.ini │ │ ├── core-plugins.json │ │ ├── graph.json │ │ ├── core-plugins-migration.json │ │ └── workspace.json │ ├── desktop.ini │ ├── Codes │ │ ├── desktop.ini │ │ └── Custom_Exception_Handling.c++ │ └── Notes │ │ ├── desktop.ini │ │ ├── 07_File_Handling.md │ │ ├── 04_Standard_template_library_(STL).md │ │ ├── 05_Pointers_and_memory_managment.md │ │ ├── 02_Functions.md │ │ ├── 06_Exception_Handling.md │ │ ├── 01_Fundamentals.md │ │ ├── 03_Object_Oriented_Programming.md │ │ └── 08_Advanced_Topics.md ├── Dart │ ├── .obsidian │ │ ├── app.json │ │ ├── hotkeys.json │ │ ├── appearance.json │ │ ├── core-plugins.json │ │ ├── graph.json │ │ ├── core-plugins-migration.json │ │ └── workspace.json │ ├── desktop.ini │ ├── 04_Testing_and_Debugging.md │ ├── 02_Dart_Libraries_and_Packages.md │ ├── 01_Dart_Basics_&_Oops.md │ ├── 03_Error_Handling_&_Asynchronous Programming.md │ ├── 05_Flutter_Basic_Project.md │ └── 06_Advanced_Topics.md ├── desktop.ini └── MarkDown │ ├── desktop.ini │ ├── Git Cheatsheet.md │ └── markdown-cheat-sheet.md ├── Books ├── GD with Java Code Academy │ ├── .obsidian │ │ ├── hotkeys.json │ │ ├── app.json │ │ ├── appearance.json │ │ ├── desktop.ini │ │ ├── core-plugins.json │ │ ├── core-plugins-migration.json │ │ └── workspace.json │ ├── desktop.ini │ ├── Codes │ │ ├── desktop.ini │ │ ├── Driver_Class.java │ │ ├── Extending_Class.java │ │ └── badlogic_code.java │ ├── Images │ │ ├── Life_Cycle_Of_Game.jpg │ │ └── desktop.ini │ └── Notes │ │ ├── desktop.ini │ │ └── 01_Basics.md ├── 3D Math Problems for Graphics and Game Development │ ├── .obsidian │ │ ├── app.json │ │ ├── hotkeys.json │ │ ├── appearance.json │ │ ├── core-plugins.json │ │ ├── core-plugins-migration.json │ │ └── workspace.json │ ├── desktop.ini │ └── 01_Cartesian_Cordinate_System.md └── desktop.ini ├── desktop.ini ├── RoadMap (GD).md ├── Game_Dev_Companies_Info.md └── README.md /.obsidian/hotkeys.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /DSA/.obsidian/hotkeys.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /Languages/C#/Codes/Basics.cs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Languages/.obsidian/app.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /Languages/.obsidian/hotkeys.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /Languages/C#/.obsidian/hotkeys.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /Languages/C++/.obsidian/hotkeys.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /Languages/Dart/.obsidian/app.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /Languages/Dart/.obsidian/hotkeys.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /.obsidian/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "promptDelete": false 3 | } -------------------------------------------------------------------------------- /.obsidian/appearance.json: -------------------------------------------------------------------------------- 1 | { 2 | "accentColor": "" 3 | } -------------------------------------------------------------------------------- /Books/GD with Java Code Academy/.obsidian/hotkeys.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /DSA/.obsidian/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "promptDelete": false 3 | } -------------------------------------------------------------------------------- /DSA/.obsidian/appearance.json: -------------------------------------------------------------------------------- 1 | { 2 | "accentColor": "" 3 | } -------------------------------------------------------------------------------- /Languages/.obsidian/appearance.json: -------------------------------------------------------------------------------- 1 | { 2 | "accentColor": "" 3 | } -------------------------------------------------------------------------------- /Languages/C#/.obsidian/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "promptDelete": false 3 | } -------------------------------------------------------------------------------- /Languages/C++/.obsidian/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "promptDelete": false 3 | } -------------------------------------------------------------------------------- /Languages/C#/.obsidian/appearance.json: -------------------------------------------------------------------------------- 1 | { 2 | "accentColor": "" 3 | } -------------------------------------------------------------------------------- /Languages/Dart/.obsidian/appearance.json: -------------------------------------------------------------------------------- 1 | { 2 | "accentColor": "" 3 | } -------------------------------------------------------------------------------- /Books/3D Math Problems for Graphics and Game Development/.obsidian/app.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /Books/3D Math Problems for Graphics and Game Development/.obsidian/hotkeys.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /Books/GD with Java Code Academy/.obsidian/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "promptDelete": false 3 | } -------------------------------------------------------------------------------- /Languages/C++/.obsidian/appearance.json: -------------------------------------------------------------------------------- 1 | { 2 | "accentColor": "", 3 | "baseFontSize": 15 4 | } -------------------------------------------------------------------------------- /Books/3D Math Problems for Graphics and Game Development/.obsidian/appearance.json: -------------------------------------------------------------------------------- 1 | { 2 | "accentColor": "" 3 | } -------------------------------------------------------------------------------- /Books/GD with Java Code Academy/.obsidian/appearance.json: -------------------------------------------------------------------------------- 1 | { 2 | "accentColor": "", 3 | "baseFontSize": 15 4 | } -------------------------------------------------------------------------------- /desktop.ini: -------------------------------------------------------------------------------- 1 | [.ShellClassInfo] 2 | IconResource=C:\WINDOWS\System32\SHELL32.dll,309 3 | [ViewState] 4 | Mode= 5 | Vid= 6 | FolderType=Generic 7 | -------------------------------------------------------------------------------- /Books/desktop.ini: -------------------------------------------------------------------------------- 1 | [.ShellClassInfo] 2 | IconResource=C:\WINDOWS\System32\SHELL32.dll,309 3 | [ViewState] 4 | Mode= 5 | Vid= 6 | FolderType=Generic 7 | -------------------------------------------------------------------------------- /DSA/.obsidian/desktop.ini: -------------------------------------------------------------------------------- 1 | [.ShellClassInfo] 2 | IconResource=C:\WINDOWS\System32\SHELL32.dll,309 3 | [ViewState] 4 | Mode= 5 | Vid= 6 | FolderType=Generic 7 | -------------------------------------------------------------------------------- /DSA/Notes/desktop.ini: -------------------------------------------------------------------------------- 1 | [.ShellClassInfo] 2 | IconResource=C:\WINDOWS\System32\SHELL32.dll,309 3 | [ViewState] 4 | Mode= 5 | Vid= 6 | FolderType=Generic 7 | -------------------------------------------------------------------------------- /DSA/desktop.ini: -------------------------------------------------------------------------------- 1 | [ViewState] 2 | Mode= 3 | Vid= 4 | FolderType=Generic 5 | Logo= 6 | [.ShellClassInfo] 7 | IconResource=C:\WINDOWS\System32\SHELL32.dll,309 8 | -------------------------------------------------------------------------------- /Languages/C#/desktop.ini: -------------------------------------------------------------------------------- 1 | [.ShellClassInfo] 2 | IconResource=C:\WINDOWS\System32\SHELL32.dll,309 3 | [ViewState] 4 | Mode= 5 | Vid= 6 | FolderType=Generic 7 | -------------------------------------------------------------------------------- /Languages/C++/desktop.ini: -------------------------------------------------------------------------------- 1 | [.ShellClassInfo] 2 | IconResource=C:\WINDOWS\System32\SHELL32.dll,309 3 | [ViewState] 4 | Mode= 5 | Vid= 6 | FolderType=Generic 7 | -------------------------------------------------------------------------------- /Languages/desktop.ini: -------------------------------------------------------------------------------- 1 | [.ShellClassInfo] 2 | IconResource=C:\WINDOWS\System32\SHELL32.dll,309 3 | [ViewState] 4 | Mode= 5 | Vid= 6 | FolderType=Generic 7 | -------------------------------------------------------------------------------- /Languages/C#/Codes/desktop.ini: -------------------------------------------------------------------------------- 1 | [.ShellClassInfo] 2 | IconResource=C:\WINDOWS\System32\SHELL32.dll,309 3 | [ViewState] 4 | Mode= 5 | Vid= 6 | FolderType=Generic 7 | -------------------------------------------------------------------------------- /Languages/C#/Notes/desktop.ini: -------------------------------------------------------------------------------- 1 | [.ShellClassInfo] 2 | IconResource=C:\WINDOWS\System32\SHELL32.dll,309 3 | [ViewState] 4 | Mode= 5 | Vid= 6 | FolderType=Generic 7 | -------------------------------------------------------------------------------- /Languages/Dart/desktop.ini: -------------------------------------------------------------------------------- 1 | [.ShellClassInfo] 2 | IconResource=C:\WINDOWS\System32\SHELL32.dll,309 3 | [ViewState] 4 | Mode= 5 | Vid= 6 | FolderType=Generic 7 | -------------------------------------------------------------------------------- /Languages/MarkDown/desktop.ini: -------------------------------------------------------------------------------- 1 | [.ShellClassInfo] 2 | IconResource=C:\WINDOWS\System32\SHELL32.dll,309 3 | [ViewState] 4 | Mode= 5 | Vid= 6 | FolderType=Generic 7 | -------------------------------------------------------------------------------- /Languages/.obsidian/desktop.ini: -------------------------------------------------------------------------------- 1 | [.ShellClassInfo] 2 | IconResource=C:\WINDOWS\System32\SHELL32.dll,309 3 | [ViewState] 4 | Mode= 5 | Vid= 6 | FolderType=Generic 7 | -------------------------------------------------------------------------------- /Languages/C#/.obsidian/desktop.ini: -------------------------------------------------------------------------------- 1 | [.ShellClassInfo] 2 | IconResource=C:\WINDOWS\System32\SHELL32.dll,309 3 | [ViewState] 4 | Mode= 5 | Vid= 6 | FolderType=Generic 7 | -------------------------------------------------------------------------------- /Languages/C++/.obsidian/desktop.ini: -------------------------------------------------------------------------------- 1 | [.ShellClassInfo] 2 | IconResource=C:\WINDOWS\System32\SHELL32.dll,309 3 | [ViewState] 4 | Mode= 5 | Vid= 6 | FolderType=Generic 7 | -------------------------------------------------------------------------------- /Languages/C++/Codes/desktop.ini: -------------------------------------------------------------------------------- 1 | [.ShellClassInfo] 2 | IconResource=C:\WINDOWS\System32\SHELL32.dll,309 3 | [ViewState] 4 | Mode= 5 | Vid= 6 | FolderType=Generic 7 | -------------------------------------------------------------------------------- /Languages/C++/Notes/desktop.ini: -------------------------------------------------------------------------------- 1 | [.ShellClassInfo] 2 | IconResource=C:\WINDOWS\System32\SHELL32.dll,309 3 | [ViewState] 4 | Mode= 5 | Vid= 6 | FolderType=Generic 7 | -------------------------------------------------------------------------------- /Books/GD with Java Code Academy/desktop.ini: -------------------------------------------------------------------------------- 1 | [.ShellClassInfo] 2 | IconResource=C:\WINDOWS\System32\SHELL32.dll,309 3 | [ViewState] 4 | Mode= 5 | Vid= 6 | FolderType=Generic 7 | -------------------------------------------------------------------------------- /Books/GD with Java Code Academy/Codes/desktop.ini: -------------------------------------------------------------------------------- 1 | [.ShellClassInfo] 2 | IconResource=C:\WINDOWS\System32\SHELL32.dll,309 3 | [ViewState] 4 | Mode= 5 | Vid= 6 | FolderType=Generic 7 | -------------------------------------------------------------------------------- /Books/GD with Java Code Academy/Images/Life_Cycle_Of_Game.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XxAlonexX/Game-Dev-Notes/HEAD/Books/GD with Java Code Academy/Images/Life_Cycle_Of_Game.jpg -------------------------------------------------------------------------------- /Books/GD with Java Code Academy/Images/desktop.ini: -------------------------------------------------------------------------------- 1 | [.ShellClassInfo] 2 | IconResource=C:\WINDOWS\System32\SHELL32.dll,309 3 | [ViewState] 4 | Mode= 5 | Vid= 6 | FolderType=Generic 7 | -------------------------------------------------------------------------------- /Books/GD with Java Code Academy/Notes/desktop.ini: -------------------------------------------------------------------------------- 1 | [.ShellClassInfo] 2 | IconResource=C:\WINDOWS\System32\SHELL32.dll,309 3 | [ViewState] 4 | Mode= 5 | Vid= 6 | FolderType=Generic 7 | -------------------------------------------------------------------------------- /Books/GD with Java Code Academy/.obsidian/desktop.ini: -------------------------------------------------------------------------------- 1 | [.ShellClassInfo] 2 | IconResource=C:\WINDOWS\System32\SHELL32.dll,309 3 | [ViewState] 4 | Mode= 5 | Vid= 6 | FolderType=Generic 7 | -------------------------------------------------------------------------------- /Books/3D Math Problems for Graphics and Game Development/desktop.ini: -------------------------------------------------------------------------------- 1 | [.ShellClassInfo] 2 | IconResource=C:\WINDOWS\System32\SHELL32.dll,309 3 | [ViewState] 4 | Mode= 5 | Vid= 6 | FolderType=Generic 7 | -------------------------------------------------------------------------------- /Languages/MarkDown/Git Cheatsheet.md: -------------------------------------------------------------------------------- 1 | - git init 2 | - git add --all 3 | - git commit -m "First Commit" 4 | - git branch -M main 5 | - git add remote origin `` 6 | - git push -u origin main -------------------------------------------------------------------------------- /Books/GD with Java Code Academy/Codes/Driver_Class.java: -------------------------------------------------------------------------------- 1 | public class Greeter{ 2 | public void sayHello(){ 3 | System.out.print("Hello!"); 4 | } 5 | } 6 | public class Launcher{ 7 | public static void main(){ 8 | Greeter greta = new Greeter(); 9 | greta.sayHello(); 10 | } 11 | } -------------------------------------------------------------------------------- /.obsidian/core-plugins.json: -------------------------------------------------------------------------------- 1 | [ 2 | "file-explorer", 3 | "global-search", 4 | "switcher", 5 | "graph", 6 | "backlink", 7 | "canvas", 8 | "outgoing-link", 9 | "tag-pane", 10 | "page-preview", 11 | "daily-notes", 12 | "templates", 13 | "note-composer", 14 | "command-palette", 15 | "editor-status", 16 | "bookmarks", 17 | "outline", 18 | "word-count", 19 | "file-recovery" 20 | ] -------------------------------------------------------------------------------- /Languages/.obsidian/core-plugins.json: -------------------------------------------------------------------------------- 1 | [ 2 | "file-explorer", 3 | "global-search", 4 | "switcher", 5 | "graph", 6 | "backlink", 7 | "canvas", 8 | "outgoing-link", 9 | "tag-pane", 10 | "page-preview", 11 | "daily-notes", 12 | "templates", 13 | "note-composer", 14 | "command-palette", 15 | "editor-status", 16 | "bookmarks", 17 | "outline", 18 | "word-count", 19 | "file-recovery" 20 | ] -------------------------------------------------------------------------------- /Languages/Dart/.obsidian/core-plugins.json: -------------------------------------------------------------------------------- 1 | [ 2 | "file-explorer", 3 | "global-search", 4 | "switcher", 5 | "graph", 6 | "backlink", 7 | "canvas", 8 | "outgoing-link", 9 | "tag-pane", 10 | "page-preview", 11 | "daily-notes", 12 | "templates", 13 | "note-composer", 14 | "command-palette", 15 | "editor-status", 16 | "bookmarks", 17 | "outline", 18 | "word-count", 19 | "file-recovery" 20 | ] -------------------------------------------------------------------------------- /DSA/.obsidian/core-plugins.json: -------------------------------------------------------------------------------- 1 | [ 2 | "file-explorer", 3 | "global-search", 4 | "switcher", 5 | "graph", 6 | "backlink", 7 | "canvas", 8 | "outgoing-link", 9 | "tag-pane", 10 | "properties", 11 | "page-preview", 12 | "daily-notes", 13 | "templates", 14 | "note-composer", 15 | "command-palette", 16 | "editor-status", 17 | "bookmarks", 18 | "outline", 19 | "word-count", 20 | "file-recovery" 21 | ] -------------------------------------------------------------------------------- /Books/GD with Java Code Academy/.obsidian/core-plugins.json: -------------------------------------------------------------------------------- 1 | [ 2 | "file-explorer", 3 | "global-search", 4 | "switcher", 5 | "graph", 6 | "backlink", 7 | "canvas", 8 | "outgoing-link", 9 | "tag-pane", 10 | "page-preview", 11 | "daily-notes", 12 | "templates", 13 | "note-composer", 14 | "command-palette", 15 | "editor-status", 16 | "bookmarks", 17 | "outline", 18 | "word-count", 19 | "file-recovery" 20 | ] -------------------------------------------------------------------------------- /Languages/C#/.obsidian/core-plugins.json: -------------------------------------------------------------------------------- 1 | [ 2 | "file-explorer", 3 | "global-search", 4 | "switcher", 5 | "graph", 6 | "backlink", 7 | "canvas", 8 | "outgoing-link", 9 | "tag-pane", 10 | "properties", 11 | "page-preview", 12 | "daily-notes", 13 | "templates", 14 | "note-composer", 15 | "command-palette", 16 | "editor-status", 17 | "bookmarks", 18 | "outline", 19 | "word-count", 20 | "file-recovery" 21 | ] -------------------------------------------------------------------------------- /Languages/C++/.obsidian/core-plugins.json: -------------------------------------------------------------------------------- 1 | [ 2 | "file-explorer", 3 | "global-search", 4 | "switcher", 5 | "graph", 6 | "backlink", 7 | "canvas", 8 | "outgoing-link", 9 | "tag-pane", 10 | "properties", 11 | "page-preview", 12 | "daily-notes", 13 | "templates", 14 | "note-composer", 15 | "command-palette", 16 | "editor-status", 17 | "bookmarks", 18 | "outline", 19 | "word-count", 20 | "file-recovery" 21 | ] -------------------------------------------------------------------------------- /Books/3D Math Problems for Graphics and Game Development/.obsidian/core-plugins.json: -------------------------------------------------------------------------------- 1 | [ 2 | "file-explorer", 3 | "global-search", 4 | "switcher", 5 | "graph", 6 | "backlink", 7 | "canvas", 8 | "outgoing-link", 9 | "tag-pane", 10 | "page-preview", 11 | "daily-notes", 12 | "templates", 13 | "note-composer", 14 | "command-palette", 15 | "editor-status", 16 | "bookmarks", 17 | "outline", 18 | "word-count", 19 | "file-recovery" 20 | ] -------------------------------------------------------------------------------- /Books/GD with Java Code Academy/Codes/Extending_Class.java: -------------------------------------------------------------------------------- 1 | public class Person{ 2 | String name; 3 | int HP; 4 | public void attack(Person Other) 5 | { 6 | //Attack Code Here 7 | } 8 | 9 | // Extend the Person Class as Follows: 10 | public class Wizard extends Person{ 11 | int MP; 12 | public void castSpell(String SpellName) 13 | { 14 | // Spell Code Here 15 | } 16 | } 17 | } 18 | // Then if we were to create instances of this classes; 19 | Person percy = new Person(); 20 | Wizard Merlin = new Wizard(); 21 | -------------------------------------------------------------------------------- /Languages/.obsidian/graph.json: -------------------------------------------------------------------------------- 1 | { 2 | "collapse-filter": true, 3 | "search": "", 4 | "showTags": true, 5 | "showAttachments": false, 6 | "hideUnresolved": false, 7 | "showOrphans": true, 8 | "collapse-color-groups": true, 9 | "colorGroups": [], 10 | "collapse-display": true, 11 | "showArrow": false, 12 | "textFadeMultiplier": 0, 13 | "nodeSizeMultiplier": 1, 14 | "lineSizeMultiplier": 1, 15 | "collapse-forces": true, 16 | "centerStrength": 0.518713248970312, 17 | "repelStrength": 10, 18 | "linkStrength": 1, 19 | "linkDistance": 250, 20 | "scale": 1, 21 | "close": false 22 | } -------------------------------------------------------------------------------- /Languages/C++/.obsidian/graph.json: -------------------------------------------------------------------------------- 1 | { 2 | "collapse-filter": false, 3 | "search": "", 4 | "showTags": false, 5 | "showAttachments": false, 6 | "hideUnresolved": false, 7 | "showOrphans": true, 8 | "collapse-color-groups": false, 9 | "colorGroups": [], 10 | "collapse-display": false, 11 | "showArrow": false, 12 | "textFadeMultiplier": 0, 13 | "nodeSizeMultiplier": 1, 14 | "lineSizeMultiplier": 1, 15 | "collapse-forces": false, 16 | "centerStrength": 0.518713248970312, 17 | "repelStrength": 10, 18 | "linkStrength": 1, 19 | "linkDistance": 250, 20 | "scale": 1.30140820267978, 21 | "close": true 22 | } -------------------------------------------------------------------------------- /Languages/Dart/.obsidian/graph.json: -------------------------------------------------------------------------------- 1 | { 2 | "collapse-filter": false, 3 | "search": "", 4 | "showTags": true, 5 | "showAttachments": true, 6 | "hideUnresolved": true, 7 | "showOrphans": true, 8 | "collapse-color-groups": false, 9 | "colorGroups": [], 10 | "collapse-display": false, 11 | "showArrow": false, 12 | "textFadeMultiplier": 0, 13 | "nodeSizeMultiplier": 0.835029365935515, 14 | "lineSizeMultiplier": 1, 15 | "collapse-forces": false, 16 | "centerStrength": 0.518713248970312, 17 | "repelStrength": 10, 18 | "linkStrength": 1, 19 | "linkDistance": 250, 20 | "scale": 1, 21 | "close": false 22 | } -------------------------------------------------------------------------------- /Languages/C++/Codes/Custom_Exception_Handling.c++: -------------------------------------------------------------------------------- 1 | class MyException : public exception {}; 2 | 3 | int main() { 4 | try { 5 | // Do something that could throw an exception. 6 | // For example, open a file that might not exist. 7 | // Or, divide by zero. 8 | 9 | // If an exception is thrown, the catch block will be executed. 10 | } catch (MyException& e) { 11 | // Handle the custom exception. 12 | cout << "MyException caught: " << e.what() << endl; 13 | return 1; 14 | } catch (exception& e) { 15 | // Handle other exceptions. 16 | cout << "Exception caught: " << e.what() << endl; 17 | return 1; 18 | } 19 | 20 | // If no exception is thrown, the program will continue to execute here. 21 | 22 | return 0; 23 | } 24 | -------------------------------------------------------------------------------- /.obsidian/core-plugins-migration.json: -------------------------------------------------------------------------------- 1 | { 2 | "file-explorer": true, 3 | "global-search": true, 4 | "switcher": true, 5 | "graph": true, 6 | "backlink": true, 7 | "canvas": true, 8 | "outgoing-link": true, 9 | "tag-pane": true, 10 | "properties": false, 11 | "page-preview": true, 12 | "daily-notes": true, 13 | "templates": true, 14 | "note-composer": true, 15 | "command-palette": true, 16 | "slash-command": false, 17 | "editor-status": true, 18 | "bookmarks": true, 19 | "markdown-importer": false, 20 | "zk-prefixer": false, 21 | "random-note": false, 22 | "outline": true, 23 | "word-count": true, 24 | "slides": false, 25 | "audio-recorder": false, 26 | "workspaces": false, 27 | "file-recovery": true, 28 | "publish": false, 29 | "sync": false 30 | } -------------------------------------------------------------------------------- /DSA/.obsidian/core-plugins-migration.json: -------------------------------------------------------------------------------- 1 | { 2 | "file-explorer": true, 3 | "global-search": true, 4 | "switcher": true, 5 | "graph": true, 6 | "backlink": true, 7 | "canvas": true, 8 | "outgoing-link": true, 9 | "tag-pane": true, 10 | "page-preview": true, 11 | "daily-notes": true, 12 | "templates": true, 13 | "note-composer": true, 14 | "command-palette": true, 15 | "slash-command": false, 16 | "editor-status": true, 17 | "bookmarks": true, 18 | "markdown-importer": false, 19 | "zk-prefixer": false, 20 | "random-note": false, 21 | "outline": true, 22 | "word-count": true, 23 | "slides": false, 24 | "audio-recorder": false, 25 | "workspaces": false, 26 | "file-recovery": true, 27 | "publish": false, 28 | "sync": false, 29 | "properties": true 30 | } -------------------------------------------------------------------------------- /Languages/.obsidian/core-plugins-migration.json: -------------------------------------------------------------------------------- 1 | { 2 | "file-explorer": true, 3 | "global-search": true, 4 | "switcher": true, 5 | "graph": true, 6 | "backlink": true, 7 | "canvas": true, 8 | "outgoing-link": true, 9 | "tag-pane": true, 10 | "page-preview": true, 11 | "daily-notes": true, 12 | "templates": true, 13 | "note-composer": true, 14 | "command-palette": true, 15 | "slash-command": false, 16 | "editor-status": true, 17 | "bookmarks": true, 18 | "markdown-importer": false, 19 | "zk-prefixer": false, 20 | "random-note": false, 21 | "outline": true, 22 | "word-count": true, 23 | "slides": false, 24 | "audio-recorder": false, 25 | "workspaces": false, 26 | "file-recovery": true, 27 | "publish": false, 28 | "sync": false, 29 | "properties": false 30 | } -------------------------------------------------------------------------------- /Languages/C#/.obsidian/core-plugins-migration.json: -------------------------------------------------------------------------------- 1 | { 2 | "file-explorer": true, 3 | "global-search": true, 4 | "switcher": true, 5 | "graph": true, 6 | "backlink": true, 7 | "canvas": true, 8 | "outgoing-link": true, 9 | "tag-pane": true, 10 | "properties": true, 11 | "page-preview": true, 12 | "daily-notes": true, 13 | "templates": true, 14 | "note-composer": true, 15 | "command-palette": true, 16 | "slash-command": false, 17 | "editor-status": true, 18 | "bookmarks": true, 19 | "markdown-importer": false, 20 | "zk-prefixer": false, 21 | "random-note": false, 22 | "outline": true, 23 | "word-count": true, 24 | "slides": false, 25 | "audio-recorder": false, 26 | "workspaces": false, 27 | "file-recovery": true, 28 | "publish": false, 29 | "sync": false 30 | } -------------------------------------------------------------------------------- /Languages/C++/.obsidian/core-plugins-migration.json: -------------------------------------------------------------------------------- 1 | { 2 | "file-explorer": true, 3 | "global-search": true, 4 | "switcher": true, 5 | "graph": true, 6 | "backlink": true, 7 | "canvas": true, 8 | "outgoing-link": true, 9 | "tag-pane": true, 10 | "page-preview": true, 11 | "daily-notes": true, 12 | "templates": true, 13 | "note-composer": true, 14 | "command-palette": true, 15 | "slash-command": false, 16 | "editor-status": true, 17 | "bookmarks": true, 18 | "markdown-importer": false, 19 | "zk-prefixer": false, 20 | "random-note": false, 21 | "outline": true, 22 | "word-count": true, 23 | "slides": false, 24 | "audio-recorder": false, 25 | "workspaces": false, 26 | "file-recovery": true, 27 | "publish": false, 28 | "sync": false, 29 | "properties": true 30 | } -------------------------------------------------------------------------------- /Languages/Dart/.obsidian/core-plugins-migration.json: -------------------------------------------------------------------------------- 1 | { 2 | "file-explorer": true, 3 | "global-search": true, 4 | "switcher": true, 5 | "graph": true, 6 | "backlink": true, 7 | "canvas": true, 8 | "outgoing-link": true, 9 | "tag-pane": true, 10 | "properties": false, 11 | "page-preview": true, 12 | "daily-notes": true, 13 | "templates": true, 14 | "note-composer": true, 15 | "command-palette": true, 16 | "slash-command": false, 17 | "editor-status": true, 18 | "bookmarks": true, 19 | "markdown-importer": false, 20 | "zk-prefixer": false, 21 | "random-note": false, 22 | "outline": true, 23 | "word-count": true, 24 | "slides": false, 25 | "audio-recorder": false, 26 | "workspaces": false, 27 | "file-recovery": true, 28 | "publish": false, 29 | "sync": false 30 | } -------------------------------------------------------------------------------- /DSA/Roadmap (DSA).md: -------------------------------------------------------------------------------- 1 | # Roadmap (DSA) 2 | 3 | # Roadmap for Data Structure Algorithm 4 | 5 | > Specialized format for organizing, processing, retrieving and storing data. 6 | > 7 | 8 | ### Programming Basics 9 | 10 | - C++ 11 | 12 | ### Introduction to DSA 13 | 14 | - Algorithm Complexity 15 | 16 | ### Data Structures 17 | 18 | - Arrays & Strings 19 | - Linked Lists 20 | - Stacks & Queues 21 | - Hash Tables 22 | - Trees 23 | - Heaps 24 | - Graphs 25 | 26 | ### Algorithms 27 | 28 | - Sorting Algorithms 29 | - Searching Algorithms 30 | - Recursion & Backtracking 31 | - Dynamic Programming 32 | 33 | ### Problem Solving 34 | 35 | - Hacker Rank 36 | - LeetCode 37 | - CodeForces 38 | - CodeChef 39 | 40 | ### Advanced Topics 41 | 42 | - Advance Graph Algorithms 43 | - Advanced Data Structures 44 | - String Algorithms -------------------------------------------------------------------------------- /Books/GD with Java Code Academy/.obsidian/core-plugins-migration.json: -------------------------------------------------------------------------------- 1 | { 2 | "file-explorer": true, 3 | "global-search": true, 4 | "switcher": true, 5 | "graph": true, 6 | "backlink": true, 7 | "canvas": true, 8 | "outgoing-link": true, 9 | "tag-pane": true, 10 | "properties": false, 11 | "page-preview": true, 12 | "daily-notes": true, 13 | "templates": true, 14 | "note-composer": true, 15 | "command-palette": true, 16 | "slash-command": false, 17 | "editor-status": true, 18 | "bookmarks": true, 19 | "markdown-importer": false, 20 | "zk-prefixer": false, 21 | "random-note": false, 22 | "outline": true, 23 | "word-count": true, 24 | "slides": false, 25 | "audio-recorder": false, 26 | "workspaces": false, 27 | "file-recovery": true, 28 | "publish": false, 29 | "sync": false 30 | } -------------------------------------------------------------------------------- /Books/3D Math Problems for Graphics and Game Development/.obsidian/core-plugins-migration.json: -------------------------------------------------------------------------------- 1 | { 2 | "file-explorer": true, 3 | "global-search": true, 4 | "switcher": true, 5 | "graph": true, 6 | "backlink": true, 7 | "canvas": true, 8 | "outgoing-link": true, 9 | "tag-pane": true, 10 | "properties": false, 11 | "page-preview": true, 12 | "daily-notes": true, 13 | "templates": true, 14 | "note-composer": true, 15 | "command-palette": true, 16 | "slash-command": false, 17 | "editor-status": true, 18 | "bookmarks": true, 19 | "markdown-importer": false, 20 | "zk-prefixer": false, 21 | "random-note": false, 22 | "outline": true, 23 | "word-count": true, 24 | "slides": false, 25 | "audio-recorder": false, 26 | "workspaces": false, 27 | "file-recovery": true, 28 | "publish": false, 29 | "sync": false 30 | } -------------------------------------------------------------------------------- /Books/3D Math Problems for Graphics and Game Development/01_Cartesian_Cordinate_System.md: -------------------------------------------------------------------------------- 1 | - 3D math involves precise measurements in 3D space using the Cartesian coordinate system. 2 | - René Descartes, a renowned philosopher, invented Cartesian mathematics. 3 | - Descartes also explored the question of determining the truth. 4 | #### **Discrete vs. Continuous Mathematics** 5 | Discrete mathematics (dealing with natural numbers and integers) and continuous mathematics (dealing with real numbers). Discrete mathematics involves countable elements, while continuous mathematics deals with uncountable, continuous elements. 6 | ## 2D Cartesian 7 | You probably have used 2D Cartesian coordinate systems even if you have 8 | never heard the term “Cartesian” before. “Cartesian” is mostly just a fancy 9 | word for “rectangular.” If you have ever looked at the floor plans of a house, 10 | used a street map, seen a football1 game, or played chess, you have some 11 | exposure to 2D Cartesian coordinate spaces. 12 | ## Topic 13 | -------------------------------------------------------------------------------- /RoadMap (GD).md: -------------------------------------------------------------------------------- 1 | # RoadMap (GD) 2 | 3 | # RoadMap for AI Game Programmer 4 | 5 | > An AI programmer is responsible for handling all the game's environments and non-player characters. The more detailed the AI, the better the player's experience will be. 6 | > 7 | 8 | ### Programming Languages Needed 9 | 10 | - DSA 11 | - Python 12 | - C++ 13 | 14 | ### AI Concepts 15 | 16 | - Machine Learning 17 | - Pathfinding Algorithms 18 | - Behavior Trees 19 | - Finite State Machines 20 | - Neural Networks 21 | 22 | ### Game Engine and Libraries 23 | 24 | - Unity 25 | - Unreal Engine 26 | - TensorFlow & PyTorch 27 | 28 | ### Mathematics & Algorithms 29 | 30 | - Linear Algebra 31 | - Probability & Statistics 32 | - Graph Theory 33 | 34 | ### Version Control 35 | 36 | - Git 37 | 38 | ### Books 39 | 40 | - 41 | - 42 | 43 | -------------------------------------------------------------------------------- /Books/GD with Java Code Academy/Codes/badlogic_code.java: -------------------------------------------------------------------------------- 1 | import com.badlogic.gdx.Game; 2 | import com.badlogic.gdx.Gdx; 3 | import com.badlogic.gdx.files.FileHandle; 4 | import com.badlogic.gdx.graphics.GL20; 5 | import com.badlogic.gdx.fraphics.g2d.SpriteBatch; 6 | import com.badlogic.gdx.graphics.Texture; 7 | 8 | public class HelloWorldImage extends Game 9 | { 10 | private Texture Texture; 11 | private SpriteBatch batch; 12 | public void create(){ 13 | FileHandle worldFile = Gdx.Files.internal("world.png"); 14 | texture = new Texture(worldFile); 15 | batch = new SpriteBatch(); 16 | } 17 | public void render(){ 18 | Gdx.gl.glClearColor(1,1,1,1); 19 | Gdx.gl.glClearColor(Gl.20.GL_COLOR_BUFFER_BIT); 20 | batch begin(); 21 | batch.draw( texture, 192, 112); 22 | batch.end(); 23 | } 24 | } 25 | import com.badlogic.gdx.backends.lwgl.lwjglApplication; 26 | public class HelloLauncher 27 | { 28 | public static void main (String[]args){ 29 | HelloWorldImage myProgram = new HelloWorldImage(); 30 | lwjglApplication launcher = new lwjglApplication( my program ); 31 | } 32 | } -------------------------------------------------------------------------------- /Languages/Dart/04_Testing_and_Debugging.md: -------------------------------------------------------------------------------- 1 | To write unit tests for our application, we can use the built-in Dart `test` package. However, writing unit tests for the entire application is extensive. I'll provide a simplified example of testing the `fetchGameInfo` function. 2 | ```dart 3 | // game_store.dart 4 | 5 | import 'dart:io'; 6 | import 'package:test/test.dart'; 7 | 8 | class Game { 9 | // ... (same as before) 10 | 11 | // ... 12 | } 13 | 14 | Future fetchGameInfo() async { 15 | // ... (same as before) 16 | } 17 | 18 | void main() async { 19 | // ... 20 | 21 | test('fetchGameInfo returns valid game data', () async { 22 | Game game = await fetchGameInfo(); 23 | expect(game.title, equals("Awesome Game")); 24 | expect(game.price, equals(20)); 25 | expect(game.isAvailable, equals(true)); 26 | }); 27 | } 28 | ``` 29 | ### Code Explanation 30 | - We import the `package:test/test.dart` library for writing tests. 31 | - We define a test case that checks if the `fetchGameInfo` function returns the expected game data. 32 | 33 | To run the tests, you'll need to include the `test` package in your `pubspec.yaml` file and run `flutter test`. 34 | 35 | -------------------------------------------------------------------------------- /Languages/C#/Notes/07_Graphical_User_Interface_(GUI).md: -------------------------------------------------------------------------------- 1 | Graphical User Interfaces (GUIs) are essential for building user-friendly and interactive applications. In C#, you can create GUI applications using various frameworks and libraries. Here are the key concepts and tools for GUI development in C#: 2 | # Windows Forms(WinForms) 3 | - Windows Forms is a GUI framework provided by Microsoft for creating desktop applications with a traditional Windows look and feel. 4 | - It offers a set of controls (buttons, text boxes, labels, etc.) that you can drag and drop onto forms to design the user interface. 5 | # Windows Presentation Foundation(WPF) 6 | - WPF is a more modern and versatile GUI framework for Windows desktop applications. 7 | - It uses XAML (eXtensible Application Markup Language) for designing user interfaces. 8 | - WPF offers a rich set of controls and supports advanced features like data binding, animations, and vector graphics. 9 | # Universal Windows Platform(UPF) 10 | - UWP is a framework for building Windows apps that can run on a variety of devices, including desktops, tablets, and smartphones. 11 | - UWP apps use XAML for UI design and are distributed through the Microsoft Store. 12 | 13 | 14 | -------------------------------------------------------------------------------- /Languages/Dart/02_Dart_Libraries_and_Packages.md: -------------------------------------------------------------------------------- 1 | Dart provides built-in libraries for various functionalities. In our game store, we can use the `dart:core` library for basic data types and the `dart:io` library for input and output operations. 2 | ```dart 3 | // game_store.dart 4 | 5 | import 'dart:io'; 6 | 7 | class Game { 8 | String title; 9 | int price; 10 | bool isAvailable; 11 | 12 | Game(this.title, this.price, this.isAvailable); 13 | 14 | void displayInfo() { 15 | print("Game Title: $title"); 16 | print("Game Price: \$$price"); 17 | print("Is Game Available: $isAvailable"); 18 | } 19 | } 20 | 21 | void main() { 22 | stdout.write("Enter game title: "); 23 | String title = stdin.readLineSync() ?? ""; 24 | 25 | stdout.write("Enter game price: "); 26 | int price = int.tryParse(stdin.readLineSync() ?? "") ?? 0; 27 | 28 | stdout.write("Is the game available? (true/false): "); 29 | bool isAvailable = (stdin.readLineSync()?.toLowerCase() == "true"); 30 | 31 | Game game = Game(title, price, isAvailable); 32 | game.displayInfo(); 33 | } 34 | ``` 35 | ### Code Explanation 36 | - We import the `dart:io` library for input and output operations. 37 | - We use `stdout` to display prompts and `stdin` to read user input. 38 | -------------------------------------------------------------------------------- /Languages/Dart/01_Dart_Basics_&_Oops.md: -------------------------------------------------------------------------------- 1 | # Dart Language Basics 2 | In Dart, you start by defining your variables and writing the core logic of application. 3 | Let's create a Dart file called `game_store.dart` 4 | ```dart 5 | // game_store.dart 6 | 7 | void main() { 8 | // Variables 9 | String gameTitle = "Awesome Game"; 10 | int gamePrice = 20; 11 | bool isGameAvailable = true; 12 | 13 | // Printing variables 14 | print("Game Title: $gameTitle"); 15 | print("Game Price: \$$gamePrice"); 16 | print("Is Game Available: $isGameAvailable"); 17 | } 18 | ``` 19 | ### Code Explanation 20 | - We declare variables for the game title, price, and availability. 21 | - We use the `print` function to display information in the console. 22 | # Object Oriented Programming 23 | In the context of a game store, we can create a `Game` class to represent games with properties like title, price, and availability. 24 | ```dart 25 | // game_store.dart 26 | 27 | class Game { 28 | String title; 29 | int price; 30 | bool isAvailable; 31 | 32 | Game(this.title, this.price, this.isAvailable); 33 | 34 | void displayInfo() { 35 | print("Game Title: $title"); 36 | print("Game Price: \$$price"); 37 | print("Is Game Available: $isAvailable"); 38 | } 39 | } 40 | 41 | void main() { 42 | Game game = Game("Awesome Game", 20, true); 43 | game.displayInfo(); 44 | } 45 | ``` 46 | ### Code Explanation 47 | - We define a `Game` class with properties and a constructor. 48 | - We create an instance of the `Game` class and call the `displayInfo` method to print game information. -------------------------------------------------------------------------------- /Languages/C#/Notes/04_Exception_Handling.md: -------------------------------------------------------------------------------- 1 | - Handle exceptions at an appropriate level in your application, considering where you can provide meaningful error messages and recover from errors. 2 | - Avoid catching and swallowing exceptions without appropriate handling or logging. 3 | - Log exceptions for debugging and monitoring purposes. 4 | - Use specific exception types when possible to catch only the expected exceptions. 5 | 6 | ```cs 7 | using System; 8 | 9 | class Program 10 | { 11 | static void Main() 12 | { 13 | Console.WriteLine("Welcome to the Guess the Number game!"); 14 | Console.WriteLine("I've selected a number between 1 and 100. Try to guess it."); 15 | 16 | // Generate a random number between 1 and 100. 17 | Random random = new Random(); 18 | int secretNumber = random.Next(1, 101); 19 | 20 | int attempts = 0; 21 | bool hasGuessedCorrectly = false; 22 | 23 | while (!hasGuessedCorrectly) 24 | { 25 | Console.Write("Enter your guess: "); 26 | string input = Console.ReadLine(); 27 | 28 | if (int.TryParse(input, out int guess)) 29 | { 30 | attempts++; 31 | 32 | if (guess < secretNumber) 33 | { 34 | Console.WriteLine("Too low! Try again."); 35 | } 36 | else if (guess > secretNumber) 37 | { 38 | Console.WriteLine("Too high! Try again."); 39 | } 40 | else 41 | { 42 | Console.WriteLine($"Congratulations! You guessed the number {secretNumber} correctly in {attempts} attempts."); 43 | hasGuessedCorrectly = true; 44 | } 45 | } 46 | else 47 | { 48 | Console.WriteLine("Invalid input. Please enter a valid number."); 49 | } 50 | } 51 | } 52 | } 53 | ``` 54 | **Here's how the game works:** 55 | 56 | 1. The computer generates a random number between 1 and 100. 57 | 2. The player is prompted to guess the number. 58 | 3. The player's input is checked for validity (whether it's a number). 59 | 4. If the guess is too low or too high, the player is given a hint. 60 | 5. If the player guesses the correct number, they receive a congratulatory message with the number of attempts. -------------------------------------------------------------------------------- /Languages/C#/Notes/05_Collections_and_Generics.md: -------------------------------------------------------------------------------- 1 | # Arrays 2 | - An array is a fixed-size collection of elements of the same data type. 3 | - Array elements are accessed by their index, starting from 0. 4 | - Arrays have a fixed length, which cannot be changed after initialization. 5 | ```cs 6 | int[] numbers = new int[5]; // Creates an integer array with 5 elements. 7 | numbers[0] = 10; 8 | numbers[1] = 20; 9 | // ... 10 | ``` 11 | # Lists(System.Collections.Generic.list) 12 | - A list is a dynamic-size collection that can grow or shrink as needed. 13 | - Lists are part of the `System.Collections.Generic` namespace. 14 | ```cs 15 | List names = new List(); // Creates a list of strings. 16 | names.Add("Alice"); 17 | names.Add("Bob"); 18 | // ... 19 | ``` 20 | # Dictionaries(System.Collections.Generic.Dictionaries) 21 | - A dictionary is a collection of key-value pairs. 22 | - Each key is unique, and it maps to a specific value. 23 | - Dictionaries are often used for fast data retrieval based on keys 24 | ```cs 25 | Dictionary scores = new Dictionary(); 26 | scores["Alice"] = 95; 27 | scores["Bob"] = 85; 28 | // ... 29 | ``` 30 | # ArrayList(System.Collections.ArryaList) 31 | - An `ArrayList` is a non-generic collection that can hold elements of different data types. 32 | - It's less type-safe compared to generic collections like lists. 33 | ```cs 34 | ArrayList list = new ArrayList(); 35 | list.Add(42); 36 | list.Add("Hello"); 37 | // ... 38 | ``` 39 | >**Array vs Lists:** Arrays have a fixed size, while lists can grow or shrink dynamically. 40 | Lists provide more flexibility and functionality (e.g., adding, removing, searching) compared to arrays. 41 | # Enumerators(foreach Loop) 42 | You can iterate through collections using the `foreach` loop, which is based on enumerators. 43 | ```cs 44 | foreach (var item in names) 45 | { 46 | Console.WriteLine(item); 47 | } 48 | ``` 49 | # LINQ(Language Integrated Query) 50 | - LINQ allows you to query and manipulate data in collections using a SQL-like syntax. 51 | - It's a powerful tool for filtering, sorting, and transforming data. 52 | ```cs 53 | var query = from name in names 54 | where name.StartsWith("A") 55 | select name; 56 | ``` 57 | # Common Collection Interfaces 58 | C# includes common collection interfaces like `IEnumerable`, `ICollection`, and `IList` that provide a standardized way to work with collections. 59 | 60 | -------------------------------------------------------------------------------- /Languages/MarkDown/markdown-cheat-sheet.md: -------------------------------------------------------------------------------- 1 | # Markdown Cheat Sheet 2 | 3 | This Markdown cheat sheet provides a quick overview of all the Markdown syntax elements. It can’t cover every edge case, so if you need more information about any of these elements, refer to the reference guides for [basic syntax](https://www.markdownguide.org/basic-syntax) and [extended syntax](https://www.markdownguide.org/extended-syntax). 4 | 5 | ## Basic Syntax 6 | 7 | These are the elements outlined in John Gruber’s original design document. All Markdown applications support these elements. 8 | 9 | ### Heading 10 | 11 | # H1 12 | ## H2 13 | ### H3 14 | 15 | ### Bold 16 | 17 | **bold text** 18 | 19 | ### Italic 20 | 21 | *italicized text* 22 | 23 | ### Blockquote 24 | 25 | > blockquote 26 | 27 | ### Ordered List 28 | 29 | 1. First item 30 | 2. Second item 31 | 3. Third item 32 | 33 | ### Unordered List 34 | 35 | - First item 36 | - Second item 37 | - Third item 38 | 39 | ### Code 40 | 41 | `code` 42 | 43 | ### Horizontal Rule 44 | 45 | --- 46 | 47 | ### Link 48 | 49 | [Markdown Guide](https://www.markdownguide.org) 50 | 51 | ### Image 52 | 53 | ![alt text](https://www.markdownguide.org/assets/images/tux.png) 54 | 55 | ## Extended Syntax 56 | 57 | These elements extend the basic syntax by adding additional features. Not all Markdown applications support these elements. 58 | 59 | ### Table 60 | 61 | | Syntax | Description | 62 | | ----------- | ----------- | 63 | | Header | Title | 64 | | Paragraph | Text | 65 | 66 | ### Fenced Code Block 67 | 68 | ``` 69 | { 70 | "firstName": "John", 71 | "lastName": "Smith", 72 | "age": 25 73 | } 74 | ``` 75 | 76 | ### Footnote 77 | 78 | Here's a sentence with a footnote. [^1] 79 | 80 | [^1]: This is the footnote. 81 | 82 | ### Heading ID 83 | 84 | ### My Great Heading {#custom-id} 85 | 86 | ### Definition List 87 | 88 | term 89 | : definition 90 | 91 | ### Strikethrough 92 | 93 | ~~The world is flat.~~ 94 | 95 | ### Task List 96 | 97 | - [x] Write the press release 98 | - [ ] Update the website 99 | - [ ] Contact the media 100 | 101 | 102 | ### Emoji 103 | 104 | That is so funny! :joy: 105 | 106 | (See also [Copying and Pasting Emoji](https://www.markdownguide.org/extended-syntax/#copying-and-pasting-emoji)) 107 | 108 | ### Highlight 109 | 110 | I need to highlight these ==very important words==. 111 | 112 | ### Subscript 113 | 114 | H~2~O 115 | 116 | ### Superscript 117 | 118 | X^2^ -------------------------------------------------------------------------------- /Languages/C#/Notes/06_File_Input_Output.md: -------------------------------------------------------------------------------- 1 | # Reading From Files 2 | You can read data from a file using classes like `StreamReader` or `File.ReadAllText`. 3 | Using `StreamReader`: 4 | ```cs 5 | using System; 6 | using System.IO; 7 | 8 | class Program 9 | { 10 | static void Main() 11 | { 12 | try 13 | { 14 | using (StreamReader reader = new StreamReader("example.txt")) 15 | { 16 | string line; 17 | while ((line = reader.ReadLine()) != null) 18 | { 19 | Console.WriteLine(line); 20 | } 21 | } 22 | } 23 | catch (FileNotFoundException) 24 | { 25 | Console.WriteLine("File not found."); 26 | } 27 | } 28 | } 29 | ``` 30 | # Writing To Files 31 | - You can write data to a file using classes like `StreamWriter` or `File.WriteAllText`. 32 | 33 | Using `StreamWriter`: 34 | 35 | ```cs 36 | using System; 37 | using System.IO; 38 | 39 | class Program 40 | { 41 | static void Main() 42 | { 43 | try 44 | { 45 | using (StreamWriter writer = new StreamWriter("output.txt")) 46 | { 47 | writer.WriteLine("Hello, world!"); 48 | } 49 | } 50 | catch (IOException) 51 | { 52 | Console.WriteLine("An error occurred while writing to the file."); 53 | } 54 | } 55 | } 56 | ``` 57 | # File And Directory Manipulation 58 | C# provides classes like `File` and `Directory` for common file and directory operations, such as checking if a file exists, creating directories, and deleting files. 59 | ```cs 60 | using System; 61 | using System.IO; 62 | 63 | class Program 64 | { 65 | static void Main() 66 | { 67 | string filePath = "example.txt"; 68 | 69 | if (File.Exists(filePath)) 70 | { 71 | Console.WriteLine("File exists."); 72 | } 73 | else 74 | { 75 | Console.WriteLine("File does not exist."); 76 | } 77 | } 78 | } 79 | ``` 80 | # Binary File I/O 81 | - Binary file I/O is used to read and write non-text data, such as images, audio, and binary files. 82 | - Classes like `BinaryReader` and `BinaryWriter` are used for binary file operations. 83 | # Exception Handling for I/O 84 | When performing file I/O operations, it's essential to handle exceptions related to file access, such as `FileNotFoundException`, `IOException`, and `UnauthorizedAccessException`. 85 | # Asynchronous File Type 86 | C# supports asynchronous file I/O operations using the `async` and `await` keywords for improved responsiveness in applications. 87 | -------------------------------------------------------------------------------- /Languages/Dart/03_Error_Handling_&_Asynchronous Programming.md: -------------------------------------------------------------------------------- 1 | # Error Handling 2 | We can add error handling to ensure that the user enters a valid price. 3 | ```dart 4 | // game_store.dart 5 | 6 | import 'dart:io'; 7 | 8 | class Game { 9 | String title; 10 | int price; 11 | bool isAvailable; 12 | 13 | Game(this.title, this.price, this.isAvailable); 14 | 15 | void displayInfo() { 16 | print("Game Title: $title"); 17 | print("Game Price: \$$price"); 18 | print("Is Game Available: $isAvailable"); 19 | } 20 | } 21 | 22 | void main() { 23 | stdout.write("Enter game title: "); 24 | String title = stdin.readLineSync() ?? ""; 25 | 26 | int? price; 27 | while (price == null) { 28 | stdout.write("Enter game price (numeric value): "); 29 | try { 30 | price = int.parse(stdin.readLineSync() ?? ""); 31 | } catch (e) { 32 | print("Invalid input. Please enter a numeric value."); 33 | } 34 | } 35 | 36 | stdout.write("Is the game available? (true/false): "); 37 | bool isAvailable = (stdin.readLineSync()?.toLowerCase() == "true"); 38 | 39 | Game game = Game(title, price, isAvailable); 40 | game.displayInfo(); 41 | } 42 | ``` 43 | ### Code Explanation 44 | - We use a `while` loop to repeatedly prompt the user until a valid price is entered. 45 | - We catch exceptions if the user enters a non-numeric value. 46 | # Asynchronous Programming 47 | In our game purchasing store, we may want to fetch game information from a remote server, which involves asynchronous operations. Let's simulate this using Dart's `Future` and `async/await`: 48 | ```dart 49 | // game_store.dart 50 | 51 | import 'dart:io'; 52 | 53 | class Game { 54 | String title; 55 | int price; 56 | bool isAvailable; 57 | 58 | Game(this.title, this.price, this.isAvailable); 59 | 60 | void displayInfo() { 61 | print("Game Title: $title"); 62 | print("Game Price: \$$price"); 63 | print("Is Game Available: $isAvailable"); 64 | } 65 | } 66 | 67 | Future fetchGameInfo() async { 68 | await Future.delayed(Duration(seconds: 2)); // Simulate a network request delay 69 | return Game("Awesome Game", 20, true); // Simulated game data 70 | } 71 | 72 | void main() async { 73 | stdout.write("Fetching game information... "); 74 | 75 | try { 76 | Game game = await fetchGameInfo(); 77 | game.displayInfo(); 78 | } catch (e) { 79 | print("Error: Failed to fetch game information."); 80 | } 81 | } 82 | ``` 83 | ### Code Explanation 84 | - We create a `fetchGameInfo` function that simulates fetching game information from a server with a delay using `Future.delayed`. 85 | - We use the `async` and `await` keywords to handle asynchronous operations gracefully. 86 | - We handle errors using a `try-catch` block. 87 | -------------------------------------------------------------------------------- /Languages/C++/Notes/07_File_Handling.md: -------------------------------------------------------------------------------- 1 | >File handling in C++ allows you to read data from files and write data to files. This capability is essential for various applications, such as reading configuration files, processing data, or storing program output 2 | 3 | # Including Necessary Headers 4 | To work with file handling in C++, you need to include the `` and `` headers. 5 | ```cpp 6 | #include 7 | #include 8 | ``` 9 | # Opening & Closing Files 10 | - To work with a file, you first need to open it. You can open files for reading (`ifstream`), writing (`ofstream`), or both (`fstream`). 11 | - After you're done with a file, it's essential to close it to release system resources. 12 | ```cpp 13 | // Opening a file for writing 14 | std::ofstream outfile("example.txt"); 15 | 16 | // Opening a file for reading 17 | std::ifstream infile("data.txt"); 18 | 19 | // Check if the file was opened successfully 20 | if (!outfile.is_open()) { 21 | std::cerr << "Failed to open the output file." << std::endl; 22 | return 1; 23 | } 24 | 25 | // Close the file when you're done 26 | outfile.close(); 27 | ``` 28 | # Writing to Files 29 | To write data to a file, you can use the `<<` operator, just like you would with `std::cout`. 30 | ```cpp 31 | std::ofstream outfile("example.txt"); 32 | 33 | if (outfile.is_open()) { 34 | outfile << "Hello, World!" << std::endl; 35 | outfile << "This is a sample file." << std::endl; 36 | outfile.close(); 37 | } else { 38 | std::cerr << "Failed to open the output file." << std::endl; 39 | return 1; 40 | } 41 | ``` 42 | # Reading from Files 43 | To read data from a file, you can use the `>>` operator (for reading individual values) or `getline` (for reading entire lines). 44 | ```cpp 45 | std::ifstream infile("data.txt"); 46 | 47 | if (infile.is_open()) { 48 | std::string line; 49 | while (getline(infile, line)) { 50 | std::cout << line << std::endl; 51 | } 52 | infile.close(); 53 | } else { 54 | std::cerr << "Failed to open the input file." << std::endl; 55 | return 1; 56 | } 57 | ``` 58 | # Error Handling 59 | Always check if file operations (opening, reading, writing) were successful by verifying the state of the stream (e.g., `is_open()`). 60 | # File Modes 61 | When opening a file, you can specify various modes such as `std::ios::in` (input), `std::ios::out` (output), `std::ios::app` (append), and others. 62 | ```cpp 63 | std::ofstream outfile("example.txt", std::ios::app); // Append mode 64 | ``` 65 | # Working with Binary Files 66 | By default, file streams handle text files, but you can also work with binary files by specifying the `std::ios::binary` flag when opening the file. 67 | ```cpp 68 | std::ifstream binfile("binary_data.bin", std::ios::binary); 69 | ``` 70 | -------------------------------------------------------------------------------- /Languages/C#/Notes/02_Functions_and_Methods.md: -------------------------------------------------------------------------------- 1 | >In C#, functions, also known as methods, are blocks of code that perform a specific task. Methods allow you to modularize your code, making it more organized, reusable, and maintainable. 2 | ## Method Declaration 3 | - To declare a method, you specify its name, return type (if any), and parameters (if any). 4 | ```cs 5 | // Method with no parameters and no return value (void). 6 | void SayHello() 7 | { 8 | Console.WriteLine("Hello, world!"); 9 | } 10 | 11 | // Method with parameters and a return value. 12 | int Add(int a, int b) 13 | { 14 | int sum = a + b; 15 | return sum; 16 | } 17 | ``` 18 | ## Calling a Method 19 | - To execute a method, you call it by its name and provide the required arguments (if any). 20 | ```cs 21 | SayHello(); // Calling the SayHello method. 22 | 23 | int result = Add(5, 3); // Calling the Add method and storing the result in 'result'. 24 | ``` 25 | ## Return Values 26 | A method can return a value using the `return` keyword. The return type in the method declaration should match the type of value being returned. 27 | ## Parameters 28 | - Parameters are variables that you can pass to a method to provide input data. 29 | - Methods can have zero or more parameters. 30 | - Parameters are defined within parentheses in the method declaration. 31 | ```cs 32 | void Greet(string name) 33 | { 34 | Console.WriteLine("Hello, " + name + "!"); 35 | } 36 | ``` 37 | ## Method Overloading 38 | - C# allows you to define multiple methods with the same name in a class, as long as they have different parameter lists. This is known as method overloading. 39 | ```cs 40 | int Add(int a, int b) 41 | { 42 | return a + b; 43 | } 44 | 45 | double Add(double a, double b) 46 | { 47 | return a + b; 48 | } 49 | ``` 50 | ## Access Modifiers 51 | Access modifiers like `public`, `private`, and `protected` determine the visibility of methods. Public methods can be accessed from anywhere, while private methods are only accessible within the same class. 52 | ## Static Methods 53 | Static methods belong to a class rather than an instance of the class. They can be called without creating an object of the class. 54 | ```cs 55 | public static void PrintMessage() 56 | { 57 | Console.WriteLine("This is a static method."); 58 | } 59 | ``` 60 | ## Method Parameters 61 | Methods can have value parameters (pass by value) or reference parameters (pass by reference). By default, C# uses pass by value. 62 | ```cs 63 | void ModifyValue(int x) 64 | { 65 | x = 10; 66 | } 67 | 68 | void ModifyReference(ref int x) 69 | { 70 | x = 10; 71 | } 72 | ``` 73 | ## Method Return 74 | - Methods can return various types, including value types, reference types, or even custom objects. 75 | ```cs 76 | string GetMessage() 77 | { 78 | return "Hello, world!"; 79 | } 80 | ``` 81 | -------------------------------------------------------------------------------- /Languages/C++/Notes/04_Standard_template_library_(STL).md: -------------------------------------------------------------------------------- 1 | 2 | >STL stands for the Standard Template Library in C++. It is a powerful set of C++ template classes to provide general-purpose classes and functions with templates that implement many popular and commonly used algorithms and data structures like vectors, lists, queues, and stacks. 3 | 4 | # Containers 5 | Containers are data structures that store and manage collections of objects. Some common containers in the STL include: 6 | 7 | - **Vector**: A dynamic array that can grow or shrink in size. 8 | - **List**: A doubly-linked list. 9 | - **Deque**: A double-ended queue, similar to a vector but with efficient insertion/removal at both ends. 10 | - **Queue**: A first-in-first-out (FIFO) data structure. 11 | - **Stack**: A last-in-first-out (LIFO) data structure. 12 | - **Set**: A container that stores unique elements in a sorted order. 13 | - **Map**: A container that stores key-value pairs in a sorted order. 14 | 15 | # Algorithms 16 | STL provides a collection of algorithms that work on containers, including searching, sorting, and manipulating elements. Common algorithms include: 17 | 18 | - **sort**: Sorts elements in a container. 19 | - **find**: Searches for an element in a container. 20 | - **for_each**: Applies a function to each element in a container. 21 | - **copy**: Copies elements from one container to another. 22 | - **transform**: Applies a binary operation to elements in one or more containers. 23 | 24 | # Iterators 25 | - Iterators are objects used to traverse and manipulate elements within containers. They provide a uniform way to access container elements. 26 | - Common iterator types include: 27 | - **begin()**: Points to the first element. 28 | - **end()**: Points to one past the last element. 29 | - **rbegin()**: Points to the last element (for reverse iteration). 30 | - **rend()**: Points to one before the first element (for reverse iteration). 31 | 32 | # Function Objects (Functors) 33 | - Function objects are objects that behave like functions. They are used with algorithms to define custom behavior. 34 | - Functors are typically implemented as classes that overload the `operator()`. 35 | # Allocators 36 | - Allocators are used to allocate and deallocate memory for containers. 37 | - The default allocator (`std::allocator`) is provided, but you can also use custom allocators. 38 | # Smart Pointers 39 | C++11 introduced smart pointers, which are part of the STL. They include `std::shared_ptr`, `std::unique_ptr`, and `std::weak_ptr` for managing memory and ownership of objects. 40 | 41 | >STL makes it easier to write efficient and reliable C++ code by providing a wide range of pre-implemented data structures and algorithms. It encourages code reuse, readability, and maintainability, making it a valuable part of C++ programming. 42 | -------------------------------------------------------------------------------- /Languages/C#/Notes/03_Object_Orinted_Programming.md: -------------------------------------------------------------------------------- 1 | # Classes & Objects 2 | ### Classes 3 | A class is a blueprint for creating objects. It defines the structure and behavior of objects of that type. 4 | ```cs 5 | class Person 6 | { 7 | public string Name; 8 | public int Age; 9 | 10 | public void SayHello() 11 | { 12 | Console.WriteLine("Hello, my name is " + Name); 13 | } 14 | } 15 | ``` 16 | ### Objects 17 | An object is an instance of a class, representing a real-world entity or concept. You can create multiple objects from the same class. 18 | ```cs 19 | Person person1 = new Person(); 20 | person1.Name = "Alice"; 21 | person1.Age = 30; 22 | ``` 23 | 24 | # Encapsulation 25 | - Encapsulation is the concept of bundling data (fields) and methods (functions) that operate on the data into a single unit (class). It hides the internal implementation details of a class and exposes a controlled interface. 26 | - Access modifiers (`public`, `private`, `protected`, `internal`, etc.) control the visibility of class members. 27 | # Inheritance 28 | Inheritance is a mechanism that allows a class (derived or child class) to inherit the properties and behaviors of another class (base or parent class). 29 | ```cs 30 | class Student : Person 31 | { 32 | public int StudentId; 33 | } 34 | ``` 35 | # Polymorphism 36 | - Polymorphism allows objects of different classes to be treated as objects of a common base class. It enables method overriding and dynamic method binding. 37 | - Method overriding: A derived class can provide its own implementation of a method inherited from a base class. 38 | ```cs 39 | class Animal 40 | { 41 | public virtual void MakeSound() 42 | { 43 | Console.WriteLine("Animal makes a sound"); 44 | } 45 | } 46 | 47 | class Dog : Animal 48 | { 49 | public override void MakeSound() 50 | { 51 | Console.WriteLine("Dog barks"); 52 | } 53 | } 54 | ``` 55 | # Abstraction 56 | - Abstraction is the process of simplifying complex systems by breaking them into smaller, more manageable parts. In C#, you can create abstract classes and methods. 57 | - Abstract classes cannot be instantiated and are often used as base classes with one or more abstract methods that must be implemented by derived classes. 58 | # Interfaces 59 | - An interface is a contract that defines a set of methods that a class must implement. A class can implement multiple interfaces, enabling it to fulfill multiple contracts. 60 | ```cs 61 | interface IDrawable 62 | { 63 | void Draw(); 64 | } 65 | ``` 66 | # Constructors & Distructors 67 | - Constructors are special methods used to initialize objects when they are created. C# supports parameterized constructors and constructor overloading. 68 | - Destructors are used for cleaning up resources when an object is destroyed (not often used due to automatic memory management). -------------------------------------------------------------------------------- /Languages/Dart/05_Flutter_Basic_Project.md: -------------------------------------------------------------------------------- 1 | We'll focus on creating a simple Flutter user interface for our game purchasing store. We'll display the game information we've been working with and allow the user to purchase games. 2 | ```dart 3 | // main.dart 4 | 5 | import 'package:flutter/material.dart'; 6 | 7 | void main() { 8 | runApp(GameStoreApp()); 9 | } 10 | 11 | class Game { 12 | final String title; 13 | final int price; 14 | final bool isAvailable; 15 | 16 | Game(this.title, this.price, this.isAvailable); 17 | } 18 | 19 | class GameStoreApp extends StatelessWidget { 20 | final List games = [ 21 | Game("Awesome Game 1", 20, true), 22 | Game("Awesome Game 2", 25, false), 23 | Game("Awesome Game 3", 15, true), 24 | ]; 25 | 26 | @override 27 | Widget build(BuildContext context) { 28 | return MaterialApp( 29 | home: Scaffold( 30 | appBar: AppBar( 31 | title: Text('Game Purchasing Store'), 32 | ), 33 | body: ListView.builder( 34 | itemCount: games.length, 35 | itemBuilder: (context, index) { 36 | return ListTile( 37 | title: Text(games[index].title), 38 | subtitle: Text('Price: \$${games[index].price}'), 39 | trailing: games[index].isAvailable 40 | ? ElevatedButton( 41 | onPressed: () { 42 | // Add purchase logic here 43 | showDialog( 44 | context: context, 45 | builder: (BuildContext context) { 46 | return AlertDialog( 47 | title: Text('Purchase Successful'), 48 | content: Text( 49 | 'You have purchased ${games[index].title}', 50 | ), 51 | actions: [ 52 | TextButton( 53 | onPressed: () { 54 | Navigator.of(context).pop(); 55 | }, 56 | child: Text('OK'), 57 | ), 58 | ], 59 | ); 60 | }, 61 | ); 62 | }, 63 | child: Text('Purchase'), 64 | ) 65 | : Text('Not Available'), 66 | ); 67 | }, 68 | ), 69 | ), 70 | ); 71 | } 72 | } 73 | ``` 74 | ### Code Explanation 75 | - We create a simple Flutter app with a list of games displayed in a `ListView.builder`. 76 | - Each game item includes the title, price, and a "Purchase" button (ElevatedButton) if the game is available. 77 | - When the "Purchase" button is pressed, an AlertDialog is shown to simulate a successful purchase. -------------------------------------------------------------------------------- /Languages/C++/Notes/05_Pointers_and_memory_managment.md: -------------------------------------------------------------------------------- 1 | # Pointers 2 | - A pointer is a variable that stores the memory address of another variable. It allows you to indirectly access and manipulate data in memory. 3 | - Pointers are declared by specifying the data type they point to, followed by an asterisk (*). 4 | ```cpp 5 | int x = 5; // An integer variable 6 | int *ptr = &x; // A pointer to an integer, pointing to the address of 'x' 7 | ``` 8 | # Dynamic memory allocation 9 | - C++ provides two operators, `new` and `delete`, for dynamic memory allocation and deallocation. 10 | - `new` allocates memory on the heap and returns a pointer to the allocated memory. 11 | - `delete` deallocates memory previously allocated with `new`. 12 | ```cpp 13 | int *dynamicInt = new int; // Allocates memory for an integer 14 | *dynamicInt = 10; // Assigns a value to the allocated memory 15 | delete dynamicInt; // Deallocates the memory when no longer needed 16 | ``` 17 | # Memory Leaks 18 | - Failing to deallocate memory allocated with `new` can lead to memory leaks, where the program consumes more and more memory over time. 19 | - It's essential to always release dynamically allocated memory using `delete`. 20 | # Arrays and Dynamic Arrays 21 | You can use pointers to create dynamic arrays of data. 22 | ```cpp 23 | int *dynamicArray = new int[5]; // Allocates memory for an integer array of size 5 24 | dynamicArray[0] = 1; 25 | dynamicArray[1] = 2; 26 | // ... 27 | delete[] dynamicArray; // Deallocates the dynamic array 28 | ``` 29 | # Pointers and Functions 30 | Pointers can be passed as function parameters to allow functions to modify variables outside their scope. 31 | ```cpp 32 | void modifyValue(int *ptr) { 33 | *ptr = 42; // Modifies the value at the memory location pointed to by 'ptr' 34 | } 35 | 36 | int main() { 37 | int x = 5; 38 | modifyValue(&x); // Pass the address of 'x' 39 | std::cout << x << std::endl; // Output: 42 40 | return 0; 41 | } 42 | ``` 43 | # Null Pointers 44 | - Pointers can have a special value called `nullptr` (or `NULL` in older C++ code) to indicate that they do not point to a valid memory location. 45 | - Using a null pointer can help avoid crashes when working with pointers. 46 | ```cpp 47 | int *nullPtr = nullptr; // Initialize a null pointer 48 | if (nullPtr == nullptr) { 49 | std::cout << "Pointer is null." << std::endl; 50 | } 51 | ``` 52 | # Reference Pointers 53 | While pointers provide direct memory addresses, references provide an alias to existing variables. References cannot be reassigned and are often used in function parameters for efficiency. 54 | ```cpp 55 | int y = 10; 56 | int &ref = y; // 'ref' is a reference to 'y' 57 | ref = 20; // Changes the value of 'y' to 20 58 | ``` 59 | 60 | >Proper memory management is crucial to avoid memory leaks and undefined behavior in C++. Pointers and dynamic memory allocation give you control over memory, but with great power comes great responsibility. Always release allocated memory, avoid dangling pointers (pointers pointing to freed memory), and use smart pointers when possible to simplify memory management. 61 | 62 | -------------------------------------------------------------------------------- /DSA/Notes/01_Algorithm_Complexity.md: -------------------------------------------------------------------------------- 1 | Algorithm complexity, often referred to as time complexity and space complexity, is a fundamental concept in computer science. It helps us analyze and understand how the performance of an algorithm scales with the size of the input data. Understanding algorithm complexity is crucial for designing efficient algorithms and choosing the right algorithm for a given problem 2 | # Time Complexity 3 | Time complexity measures the amount of computational time an algorithm takes based on the size of its input. It helps you estimate how the execution time increases as the input size grows. Time complexity is usually expressed using big O notation (e.g., O(n), O(log n), O(n^2)). 4 | ## Time Complexity Classes 5 | - **O(1) - Constant Time**: The algorithm's runtime is independent of the input size; it executes in a constant amount of time. 6 | 7 | - **O(log n) - Logarithmic Time**: The runtime grows slowly as the input size increases. Examples include binary search and efficient divide-and-conquer algorithms. 8 | 9 | - **O(n) - Linear Time**: The runtime grows linearly with the input size. For each additional input element, the algorithm performs a constant amount of work. 10 | 11 | - **O(n log n) - Linearithmic Time**: Slightly worse than linear but still efficient. Merge sort and quicksort are examples with this complexity. 12 | 13 | - **O(n^2) - Quadratic Time**: The runtime grows quadratically with input size. Nested loops are common causes of this complexity. 14 | 15 | - **O(2^n) - Exponential Time**: Highly inefficient. The runtime doubles with each additional input element. Algorithms with exponential time complexity should be avoided for large inputs. 16 | # Space Complexity 17 | Space complexity measures the amount of memory an algorithm requires in relation to its input size. Like time complexity, it is also expressed using big O notation (e.g., O(1), O(n), O(log n)). 18 | ## Space Complexity Classes 19 | - **O(1) - Constant Space**: The algorithm uses a fixed amount of memory regardless of the input size. 20 | 21 | - **O(n) - Linear Space**: The memory usage scales linearly with the input size. 22 | 23 | - **O(log n) - Logarithmic Space**: The memory usage increases slowly with input size. 24 | 25 | - **O(n^2) - Quadratic Space**: The algorithm uses a quadratic amount of memory relative to input size. 26 | 27 | >Analyzing the time and space complexity of an algorithm is essential for: 28 | 1. **Algorithm Selection**: Choosing the right algorithm for the problem based on input size and available resources. 29 | 30 | 2. **Performance Optimization**: Identifying bottlenecks and inefficient parts of code to improve execution speed or memory usage. 31 | 32 | 3. **Predicting Scalability**: Understanding how an algorithm will perform as the input size grows, helping with system scalability planning. 33 | 34 | 4. **Comparing Algorithms**: Comparing different algorithms to solve the same problem and selecting the most suitable one for a specific context. 35 | 36 | 5. **Detecting Potential Issues**: Identifying cases where an algorithm may become impractical for large inputs. 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /DSA/Notes/03_Algorithms.md: -------------------------------------------------------------------------------- 1 | >Algorithms are step-by-step procedures or sets of rules for solving specific problems or performing tasks in a computer program. They are fundamental in computer science and are used extensively in various fields, including software development, data analysis, artificial intelligence, and more. Here are examples of common algorithms. 2 | 3 | # Sorting Algorithms 4 | - **Bubble Sort**: A simple sorting algorithm that repeatedly steps through the list, compares adjacent elements, and swaps them if they are in the wrong order. 5 | - **Quick Sort**: A divide-and-conquer sorting algorithm that partitions the list into smaller sublists, sorts them, and combines them. 6 | - **Merge Sort**: Another divide-and-conquer algorithm that divides the list into smaller lists, sorts them, and merges them together. 7 | # Searching Algorithms 8 | - **Linear Search**: A basic searching algorithm that checks each element in a list one by one until a match is found. 9 | - **Binary Search**: A more efficient searching algorithm that works on sorted lists by repeatedly dividing the search interval in half. 10 | # Pathfinding Algorithms 11 | - **Dijkstra's Algorithm**: Used to find the shortest path between two nodes in a weighted graph. 12 | - A Algorithm* : A popular pathfinding algorithm that combines Dijkstra's algorithm with heuristics to find the shortest path efficiently. 13 | # Graph Algorithms 14 | - **Breadth-First Search (BFS)**: Used for traversing or searching in graphs, often used in shortest path algorithms. 15 | - **Depth-First Search (DFS)**: Another graph traversal algorithm used for various graph-related tasks. 16 | # Dynamic Programming Algorithms 17 | - **Fibonacci Sequence using Memoization**: A dynamic programming approach to efficiently calculate Fibonacci numbers. 18 | - **Longest Common Subsequence (LCS)**: Used for finding the longest subsequence common to two sequences, often used in text comparison. 19 | # Tree Algorithms 20 | - **Binary Tree Traversal** (Inorder, Preorder, Postorder): Used to visit nodes in binary trees in different orders. 21 | - **Balanced Binary Search Tree (e.g., AVL Tree)**: A self-balancing binary search tree used for efficient searching and insertion. 22 | # String Matching Algorithms 23 | - **Brute Force String Matching**: A basic algorithm to find occurrences of a substring in a text. 24 | - **Knuth-Morris-Pratt (KMP) Algorithm**: A more efficient algorithm for substring searching. 25 | # Machine Learning Algorithms 26 | - **Linear Regression**: Used for modeling the relationship between a dependent variable and one or more independent variables. 27 | - **K-Means Clustering**: An unsupervised learning algorithm used for data clustering. 28 | # Compression Algorithms 29 | **Huffman Coding**: Used for data compression by encoding characters with variable-length codes. 30 | # Hashing Algorithms 31 | **SHA-256**: A cryptographic hash function used for data security and integrity checks. 32 | # Backtracking Algorithms 33 | **N-Queens Problem**: An example of a backtracking algorithm used to find all solutions to the N-Queens puzzle. 34 | # Greedy Algorithms 35 | **Dijkstra's Algorithm**: It can also be categorized as a greedy algorithm for finding the shortest path. 36 | # Genetic Algorithms 37 | Used in optimization and search problems, inspired by the process of natural selection. -------------------------------------------------------------------------------- /Books/GD with Java Code Academy/Notes/01_Basics.md: -------------------------------------------------------------------------------- 1 | # Extending a Class 2 | Extending a class will decrease redundancy by creating reusable code. One of the way to accomplish that is Oops Concept inheritance: the creating of new class based on existing class. 3 | ```java 4 | public class Person{ 5 | String name; 6 | int HP; 7 | public void attack(Person Other) 8 | { 9 | //Attack Code Here 10 | } 11 | 12 | // Extend the Person Class as Follows: 13 | public class Wizard extends Person{ 14 | int MP; 15 | public void castSpell(String SpellName) 16 | { 17 | // Spell Code Here 18 | } 19 | } 20 | } 21 | // Then if we were to create instances of this classes; 22 | Person percy = new Person(); 23 | Wizard Merlin = new Wizard(); 24 | 25 | ``` 26 | Then, commands such as `merlin.MP += 10 and merlin.castSpell("Fireball")` are valid, as well as commands involving fields and methods of the base class, such as `merlin.HP -= 3 and merlin.attack( percy )`. However, the object called percy can only use the fields and methods of the person class. Code such as `percy.HP += 5` will compile, but `percy.castSpell("lighting")` will result in an error when the file is compiled. 27 | # Static Methods and Driver Classes 28 | By default, the methods of a class are called by instances of that class. However, a method can also be declared to be static, meaning that it is called form the class directly (rather than an instance). Whether a method should be instance-based or class-based (static) depends on how the method is used and what data requires. 29 | An instance-based method usually depends on the internal data stored in that instance. For example, every String object has a method called `CharAt` which takes an integer as a input and returns the character stored that position in the string. If we create two string object as follows: 30 | ```java 31 | String player1 = "Lee"; 32 | String player2 = "Dan "; 33 | ``` 34 | then the expression `player1.chartAt(1)`. return the character `e`, while, `player2.charAt(1)` returns the character `a`. The value returned by this method depends on the data stored in that instance, and thus `charAt()` is most assuredly and instance-based method. 35 | # The Life Cycle of Video Game 36 | - Startup: During this stage, any files needed (such as images or sounds ) are loaded game objects are created, and when values are initialized. 37 | - The Game Loop: The stage which continuously repeated while the game is running and this contains following three sub stages: 38 | - Process Input: The programming check out if the player performed any action in order to interact with the game such as pressing keyboard, moving mouse, moving joystick etc. 39 | - Update: Performs tasks that involve the state of the game world and the entities within it. This could include change the positions of the character according the user input or physic simulation, performing Collison detection to determine when two entities come in contact with each other and can be performed in response. or selection actions for the non player character. 40 | - Render: 41 | 42 | 43 | ![[Life_Cycle_Of_Game.jpg]] 44 | ## Interfaces 45 | Informally, you can think of an interface as a kind of contract that other classes can promise to fulfill, 46 | As a simple example, let's say that you write a `Player` class, which contains a method named `TalkTo` that is used to interact with the object in the environment. The `talkTo` method takes a single input, called `creature. 47 | ```java 48 | creature.speak(); 49 | ``` 50 | 51 | -------------------------------------------------------------------------------- /Languages/Dart/06_Advanced_Topics.md: -------------------------------------------------------------------------------- 1 | # State Management 2 | - Learn about state management techniques like Provider, Riverpod, Redux, MobX, and Bloc. These are crucial for managing the state of your app as it grows in complexity. 3 | # Navigation and Routing 4 | - Explore advanced navigation techniques, such as named routes, deep linking, and routing with parameters. Consider using packages like `fluro` or `auto_route` for more control over navigation. 5 | # Flutter Widgets 6 | - Dive deeper into Flutter's rich widget library, including custom painting with `CustomPaint` and creating complex layouts with `CustomScrollView` and `Sliver` widgets. 7 | # Animations 8 | - Master Flutter's animation capabilities by using `AnimationController`, `Tween`, and implicit animations. Create fluid and engaging user interfaces with complex animations. 9 | # Flutter Performance Optimization 10 | - Learn techniques for optimizing the performance of your Flutter app, including widget optimization, lazy loading, and minimizing unnecessary rebuilds. 11 | # Flutter Web and Desktop 12 | - Explore how to extend your Flutter app to run on the web and desktop platforms. You may need to adapt your UI and functionality for different form factors. 13 | # Internationalization and Localization 14 | - Implement internationalization and localization to make your app accessible to users worldwide. Flutter provides tools like `Intl` and `flutter_localizations` for this purpose. 15 | # Flutter Packages and Plugins 16 | - Discover and use third-party packages and plugins to add additional features and functionality to your app. For example, you can integrate Firebase for backend services or incorporate various APIs. 17 | # Advanced Networking 18 | - Learn advanced networking techniques, such as making HTTP requests with different libraries (e.g., Dio), handling REST APIs, and managing authentication and authorization. 19 | # Offline Data Storage 20 | - Implement offline data storage solutions, including local databases like SQLite or NoSQL databases like Hive or Moor for persistent data storage. 21 | # Flutter Testing and Debugging 22 | - Master advanced debugging techniques and tools provided by Flutter and Dart, such as the Flutter DevTools. Write comprehensive unit tests and integration tests for your app. 23 | - # Stateful and Stateless Widgets 24 | - Deepen your understanding of stateful and stateless widgets, when to use them, and how to optimize their performance. 25 | # Design Patterns 26 | - Explore design patterns like MVVM, MVC, and Clean Architecture to structure your Flutter app in a maintainable and scalable way. 27 | # Advanced UI/UX Design 28 | - Focus on creating a polished and delightful user experience by studying advanced UI/UX design principles and practices. 29 | # Accessibility and Inclusivity 30 | - Ensure your app is accessible to users with disabilities by following best practices for accessibility and inclusivity in Flutter. 31 | # Security and Data Protection 32 | - Learn about secure coding practices, encryption, and data protection to safeguard user data in your app. 33 | # Continuous Integration and Deployment (CI/CD) 34 | - Set up automated CI/CD pipelines to streamline the testing, building, and deployment of your Flutter app to various platforms. 35 | # Performance Monitoring and Analytics 36 | - Integrate performance monitoring and analytics tools like Firebase Performance Monitoring and Google Analytics to gain insights into how users interact with your app. 37 | # Monetization 38 | - If your app includes in-app purchases or advertisements, explore monetization strategies and SDKs like AdMob and in-app purchase APIs. 39 | # Scalability and Cloud Integration 40 | 41 | - Plan for scalability by considering cloud solutions like AWS, Google Cloud, or Azure for backend services as your app grows. -------------------------------------------------------------------------------- /Languages/.obsidian/workspace.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": { 3 | "id": "87f3d9433acfb14a", 4 | "type": "split", 5 | "children": [ 6 | { 7 | "id": "4c896d7f1719fb2c", 8 | "type": "tabs", 9 | "children": [ 10 | { 11 | "id": "460fc00aaeee7c06", 12 | "type": "leaf", 13 | "state": { 14 | "type": "empty", 15 | "state": {} 16 | } 17 | } 18 | ] 19 | } 20 | ], 21 | "direction": "vertical" 22 | }, 23 | "left": { 24 | "id": "ac97b190a9230740", 25 | "type": "split", 26 | "children": [ 27 | { 28 | "id": "5a486b463fe73186", 29 | "type": "tabs", 30 | "children": [ 31 | { 32 | "id": "2f74512dec4ec7f7", 33 | "type": "leaf", 34 | "state": { 35 | "type": "file-explorer", 36 | "state": { 37 | "sortOrder": "alphabetical" 38 | } 39 | } 40 | }, 41 | { 42 | "id": "1fcb84810a93ff05", 43 | "type": "leaf", 44 | "state": { 45 | "type": "search", 46 | "state": { 47 | "query": "", 48 | "matchingCase": false, 49 | "explainSearch": false, 50 | "collapseAll": false, 51 | "extraContext": false, 52 | "sortOrder": "alphabetical" 53 | } 54 | } 55 | }, 56 | { 57 | "id": "3d4b03ced682d92e", 58 | "type": "leaf", 59 | "state": { 60 | "type": "bookmarks", 61 | "state": {} 62 | } 63 | } 64 | ] 65 | } 66 | ], 67 | "direction": "horizontal", 68 | "width": 300 69 | }, 70 | "right": { 71 | "id": "084d878a3e5ff029", 72 | "type": "split", 73 | "children": [ 74 | { 75 | "id": "471a5775ce010cd3", 76 | "type": "tabs", 77 | "children": [ 78 | { 79 | "id": "d11d1c9b1cfc333b", 80 | "type": "leaf", 81 | "state": { 82 | "type": "backlink", 83 | "state": { 84 | "collapseAll": false, 85 | "extraContext": false, 86 | "sortOrder": "alphabetical", 87 | "showSearch": false, 88 | "searchQuery": "", 89 | "backlinkCollapsed": false, 90 | "unlinkedCollapsed": true 91 | } 92 | } 93 | }, 94 | { 95 | "id": "0588814daaee12f6", 96 | "type": "leaf", 97 | "state": { 98 | "type": "outgoing-link", 99 | "state": { 100 | "linksCollapsed": false, 101 | "unlinkedCollapsed": true 102 | } 103 | } 104 | }, 105 | { 106 | "id": "1a52e09bb9bcd58b", 107 | "type": "leaf", 108 | "state": { 109 | "type": "tag", 110 | "state": { 111 | "sortOrder": "frequency", 112 | "useHierarchy": true 113 | } 114 | } 115 | }, 116 | { 117 | "id": "853dd59dc308556f", 118 | "type": "leaf", 119 | "state": { 120 | "type": "outline", 121 | "state": {} 122 | } 123 | } 124 | ] 125 | } 126 | ], 127 | "direction": "horizontal", 128 | "width": 300, 129 | "collapsed": true 130 | }, 131 | "left-ribbon": { 132 | "hiddenItems": { 133 | "switcher:Open quick switcher": false, 134 | "graph:Open graph view": false, 135 | "canvas:Create new canvas": false, 136 | "daily-notes:Open today's daily note": false, 137 | "templates:Insert template": false, 138 | "command-palette:Open command palette": false 139 | } 140 | }, 141 | "active": "2f74512dec4ec7f7", 142 | "lastOpenFiles": [ 143 | "MarkDown/Git Cheatsheet.md", 144 | "MarkDown/markdown-cheat-sheet.md" 145 | ] 146 | } -------------------------------------------------------------------------------- /Languages/C++/Notes/02_Functions.md: -------------------------------------------------------------------------------- 1 | ## Declaration 2 | A function declaration specifies the function's name, return type, and its parameters (if any). It informs the compiler about the existence and signature of the function. 3 | 4 | ```Cpp 5 | return_type function_name(parameter_type1 parameter1, parameter_type2 parameter2, ...) { 6 | // Function body 7 | } 8 | ``` 9 | 10 | ```cpp 11 | int add(int x, int y) { 12 | return x + y; 13 | } 14 | ``` 15 | ## Definition 16 | The function definition provides the actual implementation of the function, including the code to be executed when the function is called. 17 | ```cpp 18 | int add(int x, int y) { 19 | return x + y; 20 | } 21 | ``` 22 | ## Function Call 23 | To use a function, you need to call it. You do this by using the function's name followed by arguments enclosed in parentheses. If the function has a return value, you can assign it to a variable or use it in an expression. 24 | ```cpp 25 | int result = add(5, 3); // Calling the add function 26 | ``` 27 | ## Return Statement 28 | Functions can return values using the `return` statement. The return type in the function declaration specifies the type of value the function should return. 29 | ```cpp 30 | int add(int x, int y) { 31 | return x + y; // Returns the sum of x and y 32 | } 33 | ``` 34 | ## Parameters 35 | Functions can accept zero or more parameters (also known as arguments) that provide data for the function to work with. Parameters are specified in the function declaration and used in the function body. 36 | ```cpp 37 | int multiply(int x, int y) { 38 | return x * y; 39 | } 40 | ``` 41 | ## Overloading 42 | C++ supports function overloading, which allows you to define multiple functions with the same name but different parameter lists. The correct function is called based on the arguments provided. 43 | ```cpp 44 | int add(int x, int y) { 45 | return x + y; 46 | } 47 | 48 | double add(double x, double y) { 49 | return x + y; 50 | } 51 | ``` 52 | ## Prototypes 53 | In larger programs, you may declare function prototypes at the beginning to inform the compiler about the functions you'll define later in the code. 54 | ```cpp 55 | // Function prototype 56 | int add(int x, int y); 57 | 58 | int main() { 59 | int result = add(5, 3); 60 | return 0; 61 | } 62 | 63 | // Function definition 64 | int add(int x, int y) { 65 | return x + y; 66 | } 67 | ``` 68 | 69 | ## Pass By value 70 | - When a parameter is passed by value, a copy of the argument's value is made and used within the function. 71 | - Changes made to the parameter inside the function do not affect the original argument. 72 | - Pass by value is the default behavior for most data types in C++. 73 | ```cpp 74 | void increment(int x) { 75 | x++; // This does not affect the original value outside the function. 76 | } 77 | 78 | int main() { 79 | int num = 5; 80 | increment(num); 81 | std::cout << num << std::endl; // Output: 5 (unchanged) 82 | return 0; 83 | } 84 | ``` 85 | 86 | ## Pass By Reference 87 | - When a parameter is passed by reference, the function operates directly on the original argument, rather than making a copy. 88 | - Changes made to the parameter inside the function affect the original data. 89 | - Pass by reference is often used when you want to modify the original data or to avoid the overhead of copying large data structures. 90 | ```cpp 91 | void increment(int &x) { 92 | x++; // This affects the original value outside the function. 93 | } 94 | 95 | int main() { 96 | int num = 5; 97 | increment(num); 98 | std::cout << num << std::endl; // Output: 6 (modified) 99 | return 0; 100 | } 101 | ``` 102 | Using Pointers 103 | ```cpp 104 | void increment(int *x) { 105 | (*x)++; // This affects the original value outside the function. 106 | } 107 | 108 | int main() { 109 | int num = 5; 110 | increment(&num); 111 | std::cout << num << std::endl; // Output: 6 (modified) 112 | return 0; 113 | } 114 | ``` 115 | >Pass by reference can be more efficient than pass by value, especially for large data structures, as it avoids copying the data. However, you should use pass by reference carefully, as it can lead to unexpected side effects when modifying data within a function. -------------------------------------------------------------------------------- /Languages/C++/Notes/06_Exception_Handling.md: -------------------------------------------------------------------------------- 1 | 2 | >Exception handling is a critical feature in C++ that allows you to deal with unexpected errors or exceptional conditions that can occur during program execution. It provides a way to gracefully handle and recover from errors, rather than allowing them to crash your program. Exception handling in C++ involves three key components: `try`, `catch`, and `throw`. 3 | 4 | # `try` Block 5 | - The `try` block is used to enclose the code where an exception might occur. 6 | - Inside the `try` block, you write the code that may throw an exception. 7 | ```cpp 8 | try { 9 | // Code that may throw an exception 10 | } 11 | ``` 12 | # `catch` Block 13 | - The `catch` block is used to catch and handle exceptions thrown in the associated `try` block. 14 | - You can have one or more `catch` blocks, each handling a specific type of exception. 15 | ```cpp 16 | try { 17 | // Code that may throw an exception 18 | } 19 | catch (ExceptionType1 &e) { 20 | // Handle ExceptionType1 21 | } 22 | catch (ExceptionType2 &e) { 23 | // Handle ExceptionType2 24 | } 25 | // ... 26 | ``` 27 | # `throw` Statement 28 | - The `throw` statement is used to explicitly throw an exception. 29 | - You can throw exceptions of different types, including built-in types, custom classes, or standard library exceptions. 30 | ```cpp 31 | if (condition) { 32 | throw SomeException("An error occurred"); 33 | } 34 | ``` 35 | 36 | Example 37 | ```cpp 38 | #include 39 | #include 40 | 41 | int divide(int x, int y) { 42 | if (y == 0) { 43 | throw std::runtime_error("Division by zero"); 44 | } 45 | return x / y; 46 | } 47 | 48 | int main() { 49 | try { 50 | int result = divide(10, 0); 51 | std::cout << "Result: " << result << std::endl; 52 | } 53 | catch (const std::exception &e) { 54 | std::cerr << "Exception caught: " << e.what() << std::endl; 55 | } 56 | 57 | return 0; 58 | } 59 | // In this example, the `divide` function may throw a `std::runtime_error` exception when dividing by zero. The `try` block in `main` catches this exception and prints an error message. 60 | ``` 61 | 62 | # Common Exception Examples 63 | C++ provides several built-in exception classes in the `` header, such as `std::runtime_error`, `std::logic_error`, `std::out_of_range`, etc. These can be used for common error conditions.tdd 64 | # stdd::exception 65 | - `std::exception` is the base class for all standard C++ exception classes. 66 | - It defines a `what()` method, which returns a description of the exception. 67 | - Derived exception classes should override this method to provide meaningful error messages. 68 | ```cpp 69 | class std::exception { 70 | public: 71 | virtual const char* what() const noexcept; 72 | }; 73 | ``` 74 | # std::logic_error 75 | - `std::logic_error` is derived from `std::exception`. 76 | - It is used for exceptions that represent errors in program logic, such as invalid arguments to functions. 77 | ```cpp 78 | class std::logic_error : public std::exception { 79 | public: 80 | explicit logic_error(const std::string& what_arg); 81 | }; 82 | ``` 83 | # std::domain_error 84 | Used when an argument to a function is outside the valid domain of that function. 85 | # std::invalid_argument 86 | Used to indicate that an argument to a function is invalid or out of range. 87 | # std::lenghth_error 88 | Used when a container or string exceeds its maximum allowed length. 89 | # std::out_of_range 90 | Used to indicate that an attempt was made to access an element outside the valid range, such as indexing a container with an out-of-range index. 91 | # Custom Exception Classes 92 | You can create your own custom exception classes by inheriting from `std::exception` or a related exception class. Custom exception classes should typically provide a meaningful `what()` method to return an error message. 93 | ```cpp 94 | class MyException : public std::exception { 95 | public: 96 | MyException(const std::string &msg) : message(msg) {} 97 | const char *what() const noexcept override { 98 | return message.c_str(); 99 | } 100 | 101 | private: 102 | std::string message; 103 | }; 104 | ``` 105 | 106 | > Exception handling is a crucial aspect of robust C++ programming, allowing you to handle errors gracefully and ensure that your program remains stable even in the presence of unexpected issues. -------------------------------------------------------------------------------- /.obsidian/workspace.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": { 3 | "id": "be000910beb0fed4", 4 | "type": "split", 5 | "children": [ 6 | { 7 | "id": "a0e8995cf1ff8a24", 8 | "type": "tabs", 9 | "children": [ 10 | { 11 | "id": "ed5d7009104a4051", 12 | "type": "leaf", 13 | "state": { 14 | "type": "markdown", 15 | "state": { 16 | "file": "README.md", 17 | "mode": "source", 18 | "source": false 19 | } 20 | } 21 | } 22 | ] 23 | } 24 | ], 25 | "direction": "vertical" 26 | }, 27 | "left": { 28 | "id": "0b401913f3554609", 29 | "type": "split", 30 | "children": [ 31 | { 32 | "id": "01bf3a68ae36e50a", 33 | "type": "tabs", 34 | "children": [ 35 | { 36 | "id": "f404efcfb1d9c724", 37 | "type": "leaf", 38 | "state": { 39 | "type": "file-explorer", 40 | "state": { 41 | "sortOrder": "alphabetical" 42 | } 43 | } 44 | }, 45 | { 46 | "id": "2fab2888f4a05d9a", 47 | "type": "leaf", 48 | "state": { 49 | "type": "search", 50 | "state": { 51 | "query": "", 52 | "matchingCase": false, 53 | "explainSearch": false, 54 | "collapseAll": false, 55 | "extraContext": false, 56 | "sortOrder": "alphabetical" 57 | } 58 | } 59 | }, 60 | { 61 | "id": "82cdd8b908cd040e", 62 | "type": "leaf", 63 | "state": { 64 | "type": "bookmarks", 65 | "state": {} 66 | } 67 | } 68 | ] 69 | } 70 | ], 71 | "direction": "horizontal", 72 | "width": 300 73 | }, 74 | "right": { 75 | "id": "5505b371a5654905", 76 | "type": "split", 77 | "children": [ 78 | { 79 | "id": "c2739ad57eafc61c", 80 | "type": "tabs", 81 | "children": [ 82 | { 83 | "id": "f0279782aec88dcf", 84 | "type": "leaf", 85 | "state": { 86 | "type": "backlink", 87 | "state": { 88 | "file": "README.md", 89 | "collapseAll": false, 90 | "extraContext": false, 91 | "sortOrder": "alphabetical", 92 | "showSearch": false, 93 | "searchQuery": "", 94 | "backlinkCollapsed": false, 95 | "unlinkedCollapsed": true 96 | } 97 | } 98 | }, 99 | { 100 | "id": "6a6a0cab9ac6de75", 101 | "type": "leaf", 102 | "state": { 103 | "type": "outgoing-link", 104 | "state": { 105 | "file": "README.md", 106 | "linksCollapsed": false, 107 | "unlinkedCollapsed": true 108 | } 109 | } 110 | }, 111 | { 112 | "id": "0afc6c1ccb2fdf02", 113 | "type": "leaf", 114 | "state": { 115 | "type": "tag", 116 | "state": { 117 | "sortOrder": "frequency", 118 | "useHierarchy": true 119 | } 120 | } 121 | }, 122 | { 123 | "id": "d88e937ae44942a3", 124 | "type": "leaf", 125 | "state": { 126 | "type": "outline", 127 | "state": { 128 | "file": "README.md" 129 | } 130 | } 131 | } 132 | ] 133 | } 134 | ], 135 | "direction": "horizontal", 136 | "width": 300, 137 | "collapsed": true 138 | }, 139 | "left-ribbon": { 140 | "hiddenItems": { 141 | "switcher:Open quick switcher": false, 142 | "graph:Open graph view": false, 143 | "canvas:Create new canvas": false, 144 | "daily-notes:Open today's daily note": false, 145 | "templates:Insert template": false, 146 | "command-palette:Open command palette": false 147 | } 148 | }, 149 | "active": "ed5d7009104a4051", 150 | "lastOpenFiles": [ 151 | "programming-languages.md", 152 | "README.md" 153 | ] 154 | } -------------------------------------------------------------------------------- /Books/3D Math Problems for Graphics and Game Development/.obsidian/workspace.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": { 3 | "id": "1668760e136bc177", 4 | "type": "split", 5 | "children": [ 6 | { 7 | "id": "84e75f2e78e87a46", 8 | "type": "tabs", 9 | "children": [ 10 | { 11 | "id": "834e8bdd28deb34b", 12 | "type": "leaf", 13 | "state": { 14 | "type": "markdown", 15 | "state": { 16 | "file": "01_Cartesian_Cordinate_System.md", 17 | "mode": "source", 18 | "source": false 19 | } 20 | } 21 | } 22 | ] 23 | } 24 | ], 25 | "direction": "vertical" 26 | }, 27 | "left": { 28 | "id": "55ba0fec9d88dc85", 29 | "type": "split", 30 | "children": [ 31 | { 32 | "id": "8e479d5b981c130a", 33 | "type": "tabs", 34 | "children": [ 35 | { 36 | "id": "d40b839ea50a954a", 37 | "type": "leaf", 38 | "state": { 39 | "type": "file-explorer", 40 | "state": { 41 | "sortOrder": "alphabetical" 42 | } 43 | } 44 | }, 45 | { 46 | "id": "7274ce24dfb9a577", 47 | "type": "leaf", 48 | "state": { 49 | "type": "search", 50 | "state": { 51 | "query": "", 52 | "matchingCase": false, 53 | "explainSearch": false, 54 | "collapseAll": false, 55 | "extraContext": false, 56 | "sortOrder": "alphabetical" 57 | } 58 | } 59 | }, 60 | { 61 | "id": "90d07035e70940d3", 62 | "type": "leaf", 63 | "state": { 64 | "type": "bookmarks", 65 | "state": {} 66 | } 67 | } 68 | ] 69 | } 70 | ], 71 | "direction": "horizontal", 72 | "width": 300 73 | }, 74 | "right": { 75 | "id": "da86db3ef8338369", 76 | "type": "split", 77 | "children": [ 78 | { 79 | "id": "b8a1e6b27f377943", 80 | "type": "tabs", 81 | "children": [ 82 | { 83 | "id": "5ec9d52a08899266", 84 | "type": "leaf", 85 | "state": { 86 | "type": "backlink", 87 | "state": { 88 | "file": "01_Cartesian_Cordinate_System.md", 89 | "collapseAll": false, 90 | "extraContext": false, 91 | "sortOrder": "alphabetical", 92 | "showSearch": false, 93 | "searchQuery": "", 94 | "backlinkCollapsed": false, 95 | "unlinkedCollapsed": true 96 | } 97 | } 98 | }, 99 | { 100 | "id": "0c4216e43dbc7553", 101 | "type": "leaf", 102 | "state": { 103 | "type": "outgoing-link", 104 | "state": { 105 | "file": "01_Cartesian_Cordinate_System.md", 106 | "linksCollapsed": false, 107 | "unlinkedCollapsed": true 108 | } 109 | } 110 | }, 111 | { 112 | "id": "31399f5abcee4106", 113 | "type": "leaf", 114 | "state": { 115 | "type": "tag", 116 | "state": { 117 | "sortOrder": "frequency", 118 | "useHierarchy": true 119 | } 120 | } 121 | }, 122 | { 123 | "id": "6ecb177d0b6962fb", 124 | "type": "leaf", 125 | "state": { 126 | "type": "outline", 127 | "state": { 128 | "file": "01_Cartesian_Cordinate_System.md" 129 | } 130 | } 131 | } 132 | ] 133 | } 134 | ], 135 | "direction": "horizontal", 136 | "width": 300, 137 | "collapsed": true 138 | }, 139 | "left-ribbon": { 140 | "hiddenItems": { 141 | "switcher:Open quick switcher": false, 142 | "graph:Open graph view": false, 143 | "canvas:Create new canvas": false, 144 | "daily-notes:Open today's daily note": false, 145 | "templates:Insert template": false, 146 | "command-palette:Open command palette": false 147 | } 148 | }, 149 | "active": "834e8bdd28deb34b", 150 | "lastOpenFiles": [ 151 | "Game_Dev_Companies_Info.md", 152 | "Pasted image 20230923122045.png", 153 | "().md", 154 | "01_Cartesian_Cordinate_System.md", 155 | "Game_Dev_Companies_Info01.md" 156 | ] 157 | } -------------------------------------------------------------------------------- /DSA/.obsidian/workspace.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": { 3 | "id": "11cef4574c5113a6", 4 | "type": "split", 5 | "children": [ 6 | { 7 | "id": "52fe5f37b737ee4c", 8 | "type": "tabs", 9 | "children": [ 10 | { 11 | "id": "1c7852bd100a913d", 12 | "type": "leaf", 13 | "state": { 14 | "type": "markdown", 15 | "state": { 16 | "file": "Notes/01_Algorithm_Complexity.md", 17 | "mode": "source", 18 | "source": false 19 | } 20 | } 21 | } 22 | ] 23 | } 24 | ], 25 | "direction": "vertical" 26 | }, 27 | "left": { 28 | "id": "d3ca2b08209c7a5c", 29 | "type": "split", 30 | "children": [ 31 | { 32 | "id": "756df634cd72702f", 33 | "type": "tabs", 34 | "children": [ 35 | { 36 | "id": "45b0a4ff23de5eb4", 37 | "type": "leaf", 38 | "state": { 39 | "type": "file-explorer", 40 | "state": { 41 | "sortOrder": "alphabetical" 42 | } 43 | } 44 | }, 45 | { 46 | "id": "6f2ec04b0b217af1", 47 | "type": "leaf", 48 | "state": { 49 | "type": "search", 50 | "state": { 51 | "query": "", 52 | "matchingCase": false, 53 | "explainSearch": false, 54 | "collapseAll": false, 55 | "extraContext": false, 56 | "sortOrder": "alphabetical" 57 | } 58 | } 59 | }, 60 | { 61 | "id": "bb355b95cc21301b", 62 | "type": "leaf", 63 | "state": { 64 | "type": "bookmarks", 65 | "state": {} 66 | } 67 | } 68 | ] 69 | } 70 | ], 71 | "direction": "horizontal", 72 | "width": 300 73 | }, 74 | "right": { 75 | "id": "a84e23f71d3fa491", 76 | "type": "split", 77 | "children": [ 78 | { 79 | "id": "385f76c8595dcd4e", 80 | "type": "tabs", 81 | "children": [ 82 | { 83 | "id": "d98cc2a362ba63d5", 84 | "type": "leaf", 85 | "state": { 86 | "type": "backlink", 87 | "state": { 88 | "file": "Notes/01_Algorithm_Complexity.md", 89 | "collapseAll": false, 90 | "extraContext": false, 91 | "sortOrder": "alphabetical", 92 | "showSearch": false, 93 | "searchQuery": "", 94 | "backlinkCollapsed": false, 95 | "unlinkedCollapsed": true 96 | } 97 | } 98 | }, 99 | { 100 | "id": "2d2b6d6497640dc5", 101 | "type": "leaf", 102 | "state": { 103 | "type": "outgoing-link", 104 | "state": { 105 | "file": "Notes/01_Algorithm_Complexity.md", 106 | "linksCollapsed": false, 107 | "unlinkedCollapsed": true 108 | } 109 | } 110 | }, 111 | { 112 | "id": "d0406b86110e785e", 113 | "type": "leaf", 114 | "state": { 115 | "type": "tag", 116 | "state": { 117 | "sortOrder": "frequency", 118 | "useHierarchy": true 119 | } 120 | } 121 | }, 122 | { 123 | "id": "643f0fdcf7f252fa", 124 | "type": "leaf", 125 | "state": { 126 | "type": "outline", 127 | "state": { 128 | "file": "Notes/01_Algorithm_Complexity.md" 129 | } 130 | } 131 | } 132 | ] 133 | } 134 | ], 135 | "direction": "horizontal", 136 | "width": 300, 137 | "collapsed": true 138 | }, 139 | "left-ribbon": { 140 | "hiddenItems": { 141 | "switcher:Open quick switcher": false, 142 | "graph:Open graph view": false, 143 | "canvas:Create new canvas": false, 144 | "daily-notes:Open today's daily note": false, 145 | "templates:Insert template": false, 146 | "command-palette:Open command palette": false 147 | } 148 | }, 149 | "active": "1c7852bd100a913d", 150 | "lastOpenFiles": [ 151 | "C++ Data Structures and Algorithms Cheat Sheet.md", 152 | "Notes/desktop.ini", 153 | "Notes/01_Algorithm_Complexity.md", 154 | "Notes/02_Data_Structure.md", 155 | "Notes/03_Algorithms.md", 156 | "Notes/04_Advanced_Topics.md", 157 | "Roadmap (DSA).md", 158 | "Untitled", 159 | "Notes" 160 | ] 161 | } -------------------------------------------------------------------------------- /Books/GD with Java Code Academy/.obsidian/workspace.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": { 3 | "id": "5082d3e314b28f1c", 4 | "type": "split", 5 | "children": [ 6 | { 7 | "id": "7af8f67c0e8e1976", 8 | "type": "tabs", 9 | "children": [ 10 | { 11 | "id": "b3139916881444c0", 12 | "type": "leaf", 13 | "state": { 14 | "type": "markdown", 15 | "state": { 16 | "file": "Notes/01_Basics.md", 17 | "mode": "source", 18 | "source": false 19 | } 20 | } 21 | }, 22 | { 23 | "id": "38b550a884f0f8b4", 24 | "type": "leaf", 25 | "state": { 26 | "type": "empty", 27 | "state": {} 28 | } 29 | } 30 | ] 31 | } 32 | ], 33 | "direction": "vertical" 34 | }, 35 | "left": { 36 | "id": "ae8a6e93d00392fb", 37 | "type": "split", 38 | "children": [ 39 | { 40 | "id": "4f4379846cf64d97", 41 | "type": "tabs", 42 | "children": [ 43 | { 44 | "id": "e1feb68f1e875342", 45 | "type": "leaf", 46 | "state": { 47 | "type": "file-explorer", 48 | "state": { 49 | "sortOrder": "alphabetical" 50 | } 51 | } 52 | }, 53 | { 54 | "id": "55f1e5fe76d2c2b0", 55 | "type": "leaf", 56 | "state": { 57 | "type": "search", 58 | "state": { 59 | "query": "", 60 | "matchingCase": false, 61 | "explainSearch": false, 62 | "collapseAll": false, 63 | "extraContext": false, 64 | "sortOrder": "alphabetical" 65 | } 66 | } 67 | }, 68 | { 69 | "id": "b67787426fbdb801", 70 | "type": "leaf", 71 | "state": { 72 | "type": "bookmarks", 73 | "state": {} 74 | } 75 | } 76 | ] 77 | } 78 | ], 79 | "direction": "horizontal", 80 | "width": 300 81 | }, 82 | "right": { 83 | "id": "b2a044286f542802", 84 | "type": "split", 85 | "children": [ 86 | { 87 | "id": "91c7a64076d0446d", 88 | "type": "tabs", 89 | "children": [ 90 | { 91 | "id": "96a8320f008f5a81", 92 | "type": "leaf", 93 | "state": { 94 | "type": "backlink", 95 | "state": { 96 | "file": "Notes/01_Basics.md", 97 | "collapseAll": false, 98 | "extraContext": false, 99 | "sortOrder": "alphabetical", 100 | "showSearch": false, 101 | "searchQuery": "", 102 | "backlinkCollapsed": false, 103 | "unlinkedCollapsed": true 104 | } 105 | } 106 | }, 107 | { 108 | "id": "3625682bdf366318", 109 | "type": "leaf", 110 | "state": { 111 | "type": "outgoing-link", 112 | "state": { 113 | "file": "Notes/01_Basics.md", 114 | "linksCollapsed": false, 115 | "unlinkedCollapsed": true 116 | } 117 | } 118 | }, 119 | { 120 | "id": "de062d5ba76804c5", 121 | "type": "leaf", 122 | "state": { 123 | "type": "tag", 124 | "state": { 125 | "sortOrder": "frequency", 126 | "useHierarchy": true 127 | } 128 | } 129 | }, 130 | { 131 | "id": "a6844b0cbfd02cb3", 132 | "type": "leaf", 133 | "state": { 134 | "type": "outline", 135 | "state": { 136 | "file": "Notes/01_Basics.md" 137 | } 138 | } 139 | } 140 | ] 141 | } 142 | ], 143 | "direction": "horizontal", 144 | "width": 300, 145 | "collapsed": true 146 | }, 147 | "left-ribbon": { 148 | "hiddenItems": { 149 | "switcher:Open quick switcher": false, 150 | "graph:Open graph view": false, 151 | "canvas:Create new canvas": false, 152 | "daily-notes:Open today's daily note": false, 153 | "templates:Insert template": false, 154 | "command-palette:Open command palette": false 155 | } 156 | }, 157 | "active": "b3139916881444c0", 158 | "lastOpenFiles": [ 159 | "01_Basics.md", 160 | "Images/Life_Cycle_Of_Game.jpg", 161 | "Images/desktop.ini", 162 | "Images", 163 | "New folder", 164 | "Codes/Driver_Class.java", 165 | "Codes/badlogic_code.java", 166 | "01_Getting_Started.md", 167 | "Codes/Extending_Class.java", 168 | "Codes/desktop.ini", 169 | "Codes" 170 | ] 171 | } -------------------------------------------------------------------------------- /Languages/C++/.obsidian/workspace.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": { 3 | "id": "dacc400db231fa6f", 4 | "type": "split", 5 | "children": [ 6 | { 7 | "id": "ec8971efaf6812ac", 8 | "type": "tabs", 9 | "children": [ 10 | { 11 | "id": "cf1adc97bf859315", 12 | "type": "leaf", 13 | "state": { 14 | "type": "markdown", 15 | "state": { 16 | "file": "Notes/08_Advanced_Topics.md", 17 | "mode": "preview", 18 | "source": false 19 | } 20 | } 21 | } 22 | ] 23 | } 24 | ], 25 | "direction": "vertical" 26 | }, 27 | "left": { 28 | "id": "dc071de2a010848a", 29 | "type": "split", 30 | "children": [ 31 | { 32 | "id": "b13fc0270c9ca216", 33 | "type": "tabs", 34 | "children": [ 35 | { 36 | "id": "11c51be236383b04", 37 | "type": "leaf", 38 | "state": { 39 | "type": "file-explorer", 40 | "state": { 41 | "sortOrder": "alphabetical" 42 | } 43 | } 44 | }, 45 | { 46 | "id": "c67bcb92cb139b8e", 47 | "type": "leaf", 48 | "state": { 49 | "type": "search", 50 | "state": { 51 | "query": "", 52 | "matchingCase": false, 53 | "explainSearch": false, 54 | "collapseAll": false, 55 | "extraContext": false, 56 | "sortOrder": "alphabetical" 57 | } 58 | } 59 | }, 60 | { 61 | "id": "7741423d02d8e7c3", 62 | "type": "leaf", 63 | "state": { 64 | "type": "bookmarks", 65 | "state": {} 66 | } 67 | } 68 | ] 69 | } 70 | ], 71 | "direction": "horizontal", 72 | "width": 300 73 | }, 74 | "right": { 75 | "id": "3cb61b2997302657", 76 | "type": "split", 77 | "children": [ 78 | { 79 | "id": "464c84c4ac78a3b8", 80 | "type": "tabs", 81 | "children": [ 82 | { 83 | "id": "08b7dc441ceee694", 84 | "type": "leaf", 85 | "state": { 86 | "type": "backlink", 87 | "state": { 88 | "file": "Notes/08_Advanced_Topics.md", 89 | "collapseAll": false, 90 | "extraContext": false, 91 | "sortOrder": "alphabetical", 92 | "showSearch": false, 93 | "searchQuery": "", 94 | "backlinkCollapsed": false, 95 | "unlinkedCollapsed": true 96 | } 97 | } 98 | }, 99 | { 100 | "id": "55d819109737a715", 101 | "type": "leaf", 102 | "state": { 103 | "type": "outgoing-link", 104 | "state": { 105 | "file": "Notes/08_Advanced_Topics.md", 106 | "linksCollapsed": false, 107 | "unlinkedCollapsed": true 108 | } 109 | } 110 | }, 111 | { 112 | "id": "bb12ad07445cef93", 113 | "type": "leaf", 114 | "state": { 115 | "type": "tag", 116 | "state": { 117 | "sortOrder": "frequency", 118 | "useHierarchy": true 119 | } 120 | } 121 | }, 122 | { 123 | "id": "98cb41bcefb931e4", 124 | "type": "leaf", 125 | "state": { 126 | "type": "outline", 127 | "state": { 128 | "file": "Notes/08_Advanced_Topics.md" 129 | } 130 | } 131 | } 132 | ] 133 | } 134 | ], 135 | "direction": "horizontal", 136 | "width": 300, 137 | "collapsed": true 138 | }, 139 | "left-ribbon": { 140 | "hiddenItems": { 141 | "switcher:Open quick switcher": false, 142 | "graph:Open graph view": false, 143 | "canvas:Create new canvas": false, 144 | "daily-notes:Open today's daily note": false, 145 | "templates:Insert template": false, 146 | "command-palette:Open command palette": false 147 | } 148 | }, 149 | "active": "11c51be236383b04", 150 | "lastOpenFiles": [ 151 | "Notes/01_Fundamentals.md", 152 | "Notes/03_Object_Oriented_Programming.md", 153 | "Notes/08_Advanced_Topics.md", 154 | "Notes/07_File_Handling.md", 155 | "Notes/05_Pointers_and_memory_managment.md", 156 | "Notes/06_Exception_Handling.md", 157 | "Notes/04_Standard_template_library_(STL).md", 158 | "Notes/03_Object_oriented_programming.md", 159 | "Notes/02_Functions.md", 160 | "C++ Syntax Cheat Sheet.md", 161 | "Notes/desktop.ini", 162 | "Notes", 163 | "Variables/Datatypes/Operators.md", 164 | "Variables/Datatypes", 165 | "Variables", 166 | "Roadmap (C++).md", 167 | "Basic Codes/Functions.c++" 168 | ] 169 | } -------------------------------------------------------------------------------- /Languages/Dart/.obsidian/workspace.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": { 3 | "id": "086402f7140e0411", 4 | "type": "split", 5 | "children": [ 6 | { 7 | "id": "1edb8cc20c24cf0a", 8 | "type": "tabs", 9 | "children": [ 10 | { 11 | "id": "76c3b0390ce6ac65", 12 | "type": "leaf", 13 | "state": { 14 | "type": "markdown", 15 | "state": { 16 | "file": "05_Flutter_Basic_Project.md", 17 | "mode": "source", 18 | "source": false 19 | } 20 | } 21 | }, 22 | { 23 | "id": "0816fa6dab658740", 24 | "type": "leaf", 25 | "state": { 26 | "type": "markdown", 27 | "state": { 28 | "file": "01_Dart_Basics_&_Oops.md", 29 | "mode": "source", 30 | "source": false 31 | } 32 | } 33 | } 34 | ], 35 | "currentTab": 1 36 | } 37 | ], 38 | "direction": "vertical" 39 | }, 40 | "left": { 41 | "id": "d3116164b1aec1d4", 42 | "type": "split", 43 | "children": [ 44 | { 45 | "id": "c122b09d75aef771", 46 | "type": "tabs", 47 | "children": [ 48 | { 49 | "id": "d3960ab70a477f6a", 50 | "type": "leaf", 51 | "state": { 52 | "type": "file-explorer", 53 | "state": { 54 | "sortOrder": "alphabetical" 55 | } 56 | } 57 | }, 58 | { 59 | "id": "6f2268e49ff0c766", 60 | "type": "leaf", 61 | "state": { 62 | "type": "search", 63 | "state": { 64 | "query": "", 65 | "matchingCase": false, 66 | "explainSearch": false, 67 | "collapseAll": false, 68 | "extraContext": false, 69 | "sortOrder": "alphabetical" 70 | } 71 | } 72 | }, 73 | { 74 | "id": "02bd362f25477865", 75 | "type": "leaf", 76 | "state": { 77 | "type": "bookmarks", 78 | "state": {} 79 | } 80 | } 81 | ] 82 | } 83 | ], 84 | "direction": "horizontal", 85 | "width": 300 86 | }, 87 | "right": { 88 | "id": "cedd5f1b3edc253b", 89 | "type": "split", 90 | "children": [ 91 | { 92 | "id": "f4417a2074a6432d", 93 | "type": "tabs", 94 | "children": [ 95 | { 96 | "id": "63f1ca311bed81a5", 97 | "type": "leaf", 98 | "state": { 99 | "type": "backlink", 100 | "state": { 101 | "file": "01_Dart_Basics_&_Oops.md", 102 | "collapseAll": false, 103 | "extraContext": false, 104 | "sortOrder": "alphabetical", 105 | "showSearch": false, 106 | "searchQuery": "", 107 | "backlinkCollapsed": false, 108 | "unlinkedCollapsed": true 109 | } 110 | } 111 | }, 112 | { 113 | "id": "80bbbcb4da2c0902", 114 | "type": "leaf", 115 | "state": { 116 | "type": "outgoing-link", 117 | "state": { 118 | "file": "01_Dart_Basics_&_Oops.md", 119 | "linksCollapsed": false, 120 | "unlinkedCollapsed": true 121 | } 122 | } 123 | }, 124 | { 125 | "id": "0b7b65608fb1bf63", 126 | "type": "leaf", 127 | "state": { 128 | "type": "tag", 129 | "state": { 130 | "sortOrder": "frequency", 131 | "useHierarchy": true 132 | } 133 | } 134 | }, 135 | { 136 | "id": "9eeaa0c9f9ff2b46", 137 | "type": "leaf", 138 | "state": { 139 | "type": "outline", 140 | "state": { 141 | "file": "01_Dart_Basics_&_Oops.md" 142 | } 143 | } 144 | } 145 | ] 146 | } 147 | ], 148 | "direction": "horizontal", 149 | "width": 300, 150 | "collapsed": true 151 | }, 152 | "left-ribbon": { 153 | "hiddenItems": { 154 | "switcher:Open quick switcher": false, 155 | "graph:Open graph view": false, 156 | "canvas:Create new canvas": false, 157 | "daily-notes:Open today's daily note": false, 158 | "templates:Insert template": false, 159 | "command-palette:Open command palette": false 160 | } 161 | }, 162 | "active": "0816fa6dab658740", 163 | "lastOpenFiles": [ 164 | "06_Advanced_Topics.md", 165 | "05_Flutter_Basic_Project.md", 166 | "04_Testing_and_Debugging.md", 167 | "03_Error_Handling_&_Asynchronous Programming.md", 168 | "02_Dart_Libraries_and_Packages.md", 169 | "01_Dart_Basics_&_Oops.md" 170 | ] 171 | } -------------------------------------------------------------------------------- /Languages/C++/Notes/01_Fundamentals.md: -------------------------------------------------------------------------------- 1 | # Variables/Datatypes/Operators 2 | ## Variables 3 | - Variables are used to store data in program 4 | - They have a name (an identifier) and a data type that specifies what kind of data they can hold. 5 | - C++ is case-sensitive, so `myVariable` and `myvariable` are considered different variables. 6 | 7 | ```Cpp 8 | int age; // Declaring an integer variable named 'age' 9 | double price; // Declaring a double variable named 'price' 10 | ``` 11 | 12 | ## Data Types 13 | - Data types define the type of data a variable can store. 14 | - C++ provides several built-in data types, including: 15 | - **int**: Used for integers (whole numbers). 16 | - **double**: Used for floating-point numbers (decimals). 17 | - **char**: Used for individual characters. 18 | - **bool**: Used for Boolean values (true or false). 19 | - **string**: Used for sequences of characters. 20 | 21 | ```Cpp 22 | int age = 25; 23 | double price = 19.99; 24 | char grade = 'A'; 25 | bool isStudent = true; 26 | std::string name = "John"; 27 | 28 | ``` 29 | 30 | ## Operators 31 | - Operators are symbols used to perform operations on variables and values. 32 | - C++ supports various types of operators, including: 33 | - **Arithmetic Operators**: Used for basic mathematical operations like addition, subtraction, multiplication, division, and modulus. 34 | - **Comparison Operators**: Used to compare values and return true or false. 35 | - **Logical Operators**: Used for logical operations like AND, OR, and NOT. 36 | - **Assignment Operators**: Used to assign values to variables. 37 | - **Increment/Decrement Operators**: Used to increase or decrease the value of a variable. 38 | - **Bitwise Operators**: Used to perform operations on individual bits. 39 | - **Conditional (Ternary) Operator**: Used for conditional expressions. 40 | ```Cpp 41 | int x = 10, y = 5; 42 | int sum = x + y; // Addition 43 | int difference = x - y; // Subtraction 44 | int product = x * y; // Multiplication 45 | int quotient = x / y; // Division 46 | int remainder = x % y; // Modulus 47 | 48 | bool isGreater = (x > y); // Comparison 49 | bool logicalAnd = (x > 0) && (y > 0); // Logical AND 50 | 51 | x++; // Increment x by 1 52 | y--; // Decrement y by 1 53 | 54 | int result = (x > y) ? x : y; // Ternary Operator 55 | 56 | ``` 57 | 58 | # Control Structure 59 | Control structures in programming allow you to control the flow of your program's execution. 60 | ## Conditional Statements 61 | - **if**: Executes a block of code if a specified condition is true. 62 | - **else**: Executes a block of code if the condition in the preceding `if` statement is false. 63 | - **else if**: Used to specify multiple conditions to be checked in sequence. 64 | - **switch**: Allows you to select among several different code blocks based on the value of an expression. 65 | ```Cpp 66 | int age = 18; 67 | if (age < 18) { 68 | std::cout << "You are a minor." << std::endl; 69 | } else { 70 | std::cout << "You are an adult." << std::endl; 71 | } 72 | ``` 73 | 74 | ## Loops 75 | - **for**: Executes a block of code a specific number of times. 76 | - **while**: Repeats a block of code while a specified condition is true. 77 | - **do-while**: Similar to `while`, but ensures the code block is executed at least once. 78 | ```Cpp 79 | for (int i = 0; i < 5; i++) { 80 | std::cout << "Iteration " << i << std::endl; 81 | } 82 | ``` 83 | ## Jump Statments 84 | - **break**: Exits the current loop or switch statement. 85 | - **continue**: Skips the current iteration of a loop and proceeds to the next one. 86 | - **return**: Exits a function and optionally returns a value. 87 | **Break** 88 | ```Cpp 89 | for (int i = 0; i < 10; i++) { 90 | if (i == 5) { 91 | std::cout << "Breaking loop at iteration " << i << std::endl; 92 | break; 93 | } 94 | std::cout << "Iteration " << i << std::endl; 95 | } 96 | 97 | ``` 98 | **Continue** 99 | ```cpp 100 | #include 101 | #include 102 | 103 | void threadFunction(int threadID) { 104 | for (int i = 0; i < 5; ++i) { 105 | if (i == 2) { 106 | std::cout << "Thread " << threadID << " is skipping iteration " << i << std::endl; 107 | continue; // Skip iteration 2 108 | } 109 | std::cout << "Thread " << threadID << " is in iteration " << i << std::endl; 110 | } 111 | } 112 | 113 | int main() { 114 | std::thread t1(threadFunction, 1); 115 | std::thread t2(threadFunction, 2); 116 | 117 | t1.join(); 118 | t2.join(); 119 | 120 | return 0; 121 | } 122 | 123 | ``` 124 | **Return** 125 | ```cpp 126 | #include 127 | #include 128 | 129 | void threadFunction(int threadID) { 130 | for (int i = 0; i < 5; ++i) { 131 | if (i == 2) { 132 | std::cout << "Thread " << threadID << " is terminating at iteration " << i << std::endl; 133 | return; // Terminate the thread at iteration 2 134 | } 135 | std::cout << "Thread " << threadID << " is in iteration " << i << std::endl; 136 | } 137 | } 138 | 139 | int main() { 140 | std::thread t1(threadFunction, 1); 141 | std::thread t2(threadFunction, 2); 142 | 143 | t1.join(); 144 | t2.join(); 145 | 146 | return 0; 147 | } 148 | ``` -------------------------------------------------------------------------------- /Languages/C#/.obsidian/workspace.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": { 3 | "id": "b3add09e89349b6b", 4 | "type": "split", 5 | "children": [ 6 | { 7 | "id": "c59a8494fce455ba", 8 | "type": "tabs", 9 | "children": [ 10 | { 11 | "id": "80973188b0b6104a", 12 | "type": "leaf", 13 | "state": { 14 | "type": "markdown", 15 | "state": { 16 | "file": "Notes/01_Basic_Concepts.md", 17 | "mode": "preview", 18 | "source": false 19 | } 20 | } 21 | } 22 | ] 23 | } 24 | ], 25 | "direction": "vertical" 26 | }, 27 | "left": { 28 | "id": "27832f7c163bc8ad", 29 | "type": "split", 30 | "children": [ 31 | { 32 | "id": "a0dca3600d2e1f45", 33 | "type": "tabs", 34 | "children": [ 35 | { 36 | "id": "b179944be42ac3db", 37 | "type": "leaf", 38 | "state": { 39 | "type": "file-explorer", 40 | "state": { 41 | "sortOrder": "alphabetical" 42 | } 43 | } 44 | }, 45 | { 46 | "id": "ac12524a6c350ae6", 47 | "type": "leaf", 48 | "state": { 49 | "type": "search", 50 | "state": { 51 | "query": "", 52 | "matchingCase": false, 53 | "explainSearch": false, 54 | "collapseAll": false, 55 | "extraContext": false, 56 | "sortOrder": "alphabetical" 57 | } 58 | } 59 | }, 60 | { 61 | "id": "9147f36f92150f4a", 62 | "type": "leaf", 63 | "state": { 64 | "type": "bookmarks", 65 | "state": {} 66 | } 67 | } 68 | ] 69 | } 70 | ], 71 | "direction": "horizontal", 72 | "width": 300 73 | }, 74 | "right": { 75 | "id": "46157b0fd331f0d8", 76 | "type": "split", 77 | "children": [ 78 | { 79 | "id": "a323f02f285508f1", 80 | "type": "tabs", 81 | "children": [ 82 | { 83 | "id": "8a83de03eca10700", 84 | "type": "leaf", 85 | "state": { 86 | "type": "backlink", 87 | "state": { 88 | "file": "Notes/01_Basic_Concepts.md", 89 | "collapseAll": false, 90 | "extraContext": false, 91 | "sortOrder": "alphabetical", 92 | "showSearch": false, 93 | "searchQuery": "", 94 | "backlinkCollapsed": false, 95 | "unlinkedCollapsed": true 96 | } 97 | } 98 | }, 99 | { 100 | "id": "11beb180d37aa9e7", 101 | "type": "leaf", 102 | "state": { 103 | "type": "outgoing-link", 104 | "state": { 105 | "file": "Notes/01_Basic_Concepts.md", 106 | "linksCollapsed": false, 107 | "unlinkedCollapsed": true 108 | } 109 | } 110 | }, 111 | { 112 | "id": "8324213cce1b66ca", 113 | "type": "leaf", 114 | "state": { 115 | "type": "tag", 116 | "state": { 117 | "sortOrder": "frequency", 118 | "useHierarchy": true 119 | } 120 | } 121 | }, 122 | { 123 | "id": "6d83e0be30868dfb", 124 | "type": "leaf", 125 | "state": { 126 | "type": "outline", 127 | "state": { 128 | "file": "Notes/01_Basic_Concepts.md" 129 | } 130 | } 131 | }, 132 | { 133 | "id": "91bc05e52cb81085", 134 | "type": "leaf", 135 | "state": { 136 | "type": "all-properties", 137 | "state": { 138 | "sortOrder": "frequency" 139 | } 140 | } 141 | } 142 | ] 143 | } 144 | ], 145 | "direction": "horizontal", 146 | "width": 300, 147 | "collapsed": true 148 | }, 149 | "left-ribbon": { 150 | "hiddenItems": { 151 | "switcher:Open quick switcher": false, 152 | "graph:Open graph view": false, 153 | "canvas:Create new canvas": false, 154 | "daily-notes:Open today's daily note": false, 155 | "templates:Insert template": false, 156 | "command-palette:Open command palette": false 157 | } 158 | }, 159 | "active": "80973188b0b6104a", 160 | "lastOpenFiles": [ 161 | "Notes/02_Functions_and_Methods.md", 162 | "Notes/03_Object_Orinted_Programming.md", 163 | "Notes/04_Exception_Handling.md", 164 | "Notes/05_Collections_and_Generics.md", 165 | "Notes/06_File_Input_Output.md", 166 | "Notes/07_Graphical_User_Interface_(GUI).md", 167 | "Notes/08_Advanced_Topics.md", 168 | "Notes/01_Basic_Concepts.md", 169 | "Codes/Basics.cs", 170 | "Codes", 171 | "02_Operators.md", 172 | "Notes/desktop.ini", 173 | "Notes", 174 | "Notex", 175 | "New folder" 176 | ] 177 | } -------------------------------------------------------------------------------- /DSA/Notes/02_Data_Structure.md: -------------------------------------------------------------------------------- 1 | > A data structure is a way of organizing and storing data in a computer so that it can be accessed and modified efficiently. Data structures are essential for managing and manipulating data in software development and are used in various applications and algorithms. Here are some commonly used data structures: 2 | 3 | # Array 4 | An array is a collection of elements of the same data type stored in contiguous memory locations. Elements can be accessed by their index, making it fast for random access. 5 | - Arrays can store game assets like textures, models, or sounds. 6 | ```cpp 7 | Texture textures[10]; // An array of 10 textures 8 | ``` 9 | # Linked List 10 | A linked list is a linear data structure in which elements are stored in nodes, and each node points to the next node in the sequence. Linked lists are flexible for inserting and deleting elements but slower for random access. 11 | - Linked lists can manage game entities or components in a scene graph. 12 | ```cpp 13 | class GameObject { 14 | public: 15 | // Game object properties and methods 16 | }; 17 | 18 | class LinkedListNode { 19 | public: 20 | GameObject* data; 21 | LinkedListNode* next; 22 | }; 23 | 24 | LinkedListNode* head = nullptr; // Initialize a linked list of game objects 25 | ``` 26 | # Stack 27 | A stack is a linear data structure that follows the Last-In-First-Out (LIFO) principle. It's used for managing function calls, undo functionality, and more. 28 | - Stacks can manage game state or handle function calls. 29 | ```cpp 30 | #include 31 | std::stack gameStateStack; 32 | ``` 33 | # Queue 34 | A queue is a linear data structure that follows the First-In-First-Out (FIFO) principle. It's used for tasks like managing tasks in a printer queue or breadth-first search in graphs. 35 | **Tree**: A tree is a hierarchical data structure with a root node and child nodes. Common types include binary trees, binary search trees, and AVL trees. Trees are used in various applications, including searching, sorting, and representing hierarchical relationships. 36 | - Queues can manage tasks or actions in a game. 37 | ```cpp 38 | #include 39 | std::queue actionQueue; 40 | ``` 41 | # Graph 42 | A graph is a collection of nodes (vertices) and edges that connect these nodes. Graphs can be used to represent complex relationships, such as social networks, road networks, and more. 43 | - Graphs are used for pathfinding and navigation in game worlds. 44 | ```cpp 45 | class NavNode { 46 | public: 47 | std::vector neighbors; 48 | // Navigation properties and methods 49 | }; 50 | 51 | std::vector navigationMesh; // The navigation mesh for pathfinding 52 | 53 | ``` 54 | # Tree 55 | (Scene Graph for Game Objects): 56 | - Trees can represent scene hierarchies in games, allowing efficient rendering and transformations of game objects. 57 | ```cpp 58 | class SceneNode { 59 | public: 60 | std::vector children; 61 | // Game object properties and methods 62 | }; 63 | 64 | SceneNode* rootNode = new SceneNode(); // Root node of the scene graph 65 | 66 | ``` 67 | # Hash Table 68 | A hash table is a data structure that stores key-value pairs and provides efficient lookup and insertion operations. It uses a hash function to map keys to indices in an array. 69 | - Hash tables can implement an entity-component system (ECS) for managing game entity components efficiently. 70 | ```cpp 71 | std::unordered_map componentMap; 72 | ``` 73 | # Heap 74 | A heap is a specialized tree-based data structure that satisfies the heap property. Heaps are often used for priority queues and heap sort. 75 | - Heaps can be used in AI decision-making for selecting actions based on priorities. 76 | ```cpp 77 | #include 78 | std::priority_queue, AIActionComparator> actionQueue; 79 | ``` 80 | # Trie 81 | A trie (pronounced "try") is a tree-like data structure used for storing a dynamic set of strings. It's commonly used in applications involving strings and text, such as autocomplete systems. 82 | - Tries can provide efficient word lookup or autocomplete features in text-based games. 83 | ```cpp 84 | class TrieNode { 85 | public: 86 | std::unordered_map children; 87 | bool isWord; 88 | }; 89 | 90 | TrieNode* dictionary = new TrieNode(); // Initialize a dictionary trie 91 | ``` 92 | # Sparse Matrix 93 | A sparse matrix is a two-dimensional array where most of the elements are zero. Special data structures like the compressed sparse row (CSR) or compressed sparse column (CSC) are used to efficiently store and manipulate sparse matrices. 94 | - Sparse matrices can represent large terrain maps efficiently. 95 | ```cpp 96 | std::vector> terrainGrid; // Sparse terrain grid 97 | ``` 98 | # Bloom Filter 99 | A Bloom filter is a probabilistic data structure used to test whether an element is a member of a set. It uses a bit array and multiple hash functions. 100 | - Used for fast membership testing, e.g., checking if an item exists in a collection: 101 | ```cpp 102 | #include "bloom_filter.hpp" 103 | BloomFilter objectFilter; 104 | ``` 105 | # Skip List 106 | A skip list is a data structure that provides fast search, insertion, and deletion of elements in a sorted collection. It's often used as an alternative to balanced trees. 107 | ```cpp 108 | #include "skip_list.hpp" 109 | SkipList enemySkipList; 110 | ``` 111 | 112 | # Sparse Matrix 113 | Sparse terrain data storage for optimized rendering and collision detection. 114 | ```cpp 115 | #include "sparse_matrix.hpp" 116 | SparseMatrix terrainMap; 117 | ``` -------------------------------------------------------------------------------- /Languages/C++/Notes/03_Object_Oriented_Programming.md: -------------------------------------------------------------------------------- 1 | # Classes and Objects 2 | - A class is a blueprint or template for creating objects. It defines the structure and behavior of objects. 3 | - An object is an instance of a class. It represents a real-world entity and encapsulates data and methods (functions) to work with that data. 4 | ```cpp 5 | class Car { 6 | public: 7 | // Data members (attributes) 8 | std::string make; 9 | std::string model; 10 | int year; 11 | 12 | // Member functions (methods) 13 | void start() { 14 | // Code to start the car 15 | } 16 | 17 | void stop() { 18 | // Code to stop the car 19 | } 20 | }; 21 | ``` 22 | 23 | # Encapsulation 24 | - Encapsulation is the concept of bundling data (attributes) and the methods (functions) that operate on that data into a single unit (the class). 25 | - Access specifiers like `public`, `private`, and `protected` determine the visibility and accessibility of class members. 26 | ```cpp 27 | 28 | class Student { 29 | private: 30 | std::string name; 31 | int age; 32 | 33 | public: 34 | void setName(std::string newName) { 35 | name = newName; 36 | } 37 | 38 | std::string getName() { 39 | return name; 40 | } 41 | 42 | void setAge(int newAge) { 43 | age = newAge; 44 | } 45 | 46 | int getAge() { 47 | return age; 48 | } 49 | }; 50 | ``` 51 | 52 | # Inheritance 53 | - Inheritance allows you to create a new class (subclass or derived class) that inherits properties and behaviors from an existing class (base class or parent class). 54 | - It promotes code reuse and the creation of hierarchies of classes.\ 55 | ```cpp 56 | class Animal { 57 | public: 58 | void speak() { 59 | std::cout << "Animal speaks" << std::endl; 60 | } 61 | }; 62 | 63 | class Dog : public Animal { 64 | public: 65 | void speak() { 66 | std::cout << "Dog barks" << std::endl; 67 | } 68 | }; 69 | ``` 70 | 71 | # Polymorphism 72 | - Polymorphism allows objects of different classes to be treated as objects of a common base class. 73 | - It enables you to define a single interface or method that can work with objects of various derived classes. 74 | ```cpp 75 | class Shape { 76 | public: 77 | virtual void draw() { 78 | std::cout << "Drawing a shape" << std::endl; 79 | } 80 | }; 81 | 82 | class Circle : public Shape { 83 | public: 84 | void draw() override { 85 | std::cout << "Drawing a circle" << std::endl; 86 | } 87 | }; 88 | 89 | class Square : public Shape { 90 | public: 91 | void draw() override { 92 | std::cout << "Drawing a square" << std::endl; 93 | } 94 | }; 95 | ``` 96 | # Abstraction 97 | - Abstraction is the process of simplifying complex reality by modeling classes based on the essential properties and behaviors. 98 | - It hides the complex implementation details and exposes only the necessary functionality. 99 | 100 | # Constructors and Destructors 101 | Constructors and destructors are special member functions in C++ that are used to initialize and clean up objects of a class, respectively. 102 | ## Constructors 103 | ### Definition 104 | - A constructor is a special member function with the same name as the class. 105 | - It is called automatically when an object of the class is created. 106 | - Constructors initialize the object's data members and allocate necessary resources. 107 | ```cpp 108 | class MyClass { 109 | public: 110 | // Constructor 111 | MyClass() { 112 | // Initialization code here 113 | } 114 | }; 115 | ``` 116 | 117 | ### Default Constructor 118 | - If you don't define any constructor for a class, C++ provides a default constructor with no parameters. 119 | - You can also define your own default constructor. 120 | ```cpp 121 | class MyClass { 122 | public: 123 | // Default Constructor 124 | MyClass() { 125 | // Initialization code here 126 | } 127 | }; 128 | ``` 129 | ### Parameterized Constructors 130 | - Constructors can accept parameters to initialize the object's data members based on provided values. 131 | - Parameterized constructors allow you to create objects with different initial states. 132 | ```cpp 133 | class Person { 134 | public: 135 | // Parameterized Constructor 136 | Person(std::string name, int age) { 137 | this->name = name; 138 | this->age = age; 139 | } 140 | std::string name; 141 | int age; 142 | }; 143 | ``` 144 | 145 | ## Destructors 146 | ### Definition 147 | - A destructor is a special member function with the same name as the class, preceded by a tilde (~). 148 | - It is called automatically when an object goes out of scope or is explicitly deleted. 149 | - Destructors are used to release resources, such as memory or file handles, held by the object. 150 | ```cpp 151 | class MyClass { 152 | public: 153 | // Destructor 154 | ~MyClass() { 155 | // Cleanup code here 156 | } 157 | }; 158 | ``` 159 | ### Default Destructors 160 | - If you don't define a destructor for a class, C++ provides a default destructor that does nothing. 161 | - If your class allocates resources that need cleanup, you should define a destructor. 162 | ```cpp 163 | class MyClass { 164 | public: 165 | // Destructor 166 | ~MyClass() { 167 | // Cleanup code here (e.g., releasing memory) 168 | } 169 | }; 170 | ``` 171 | ### Resource Managment 172 | Destructors are often used for resource management, such as deallocating memory, closing files, or releasing network connections. 173 | ```cpp 174 | class FileHandler { 175 | private: 176 | FILE *file; 177 | 178 | public: 179 | FileHandler(const char *filename) { 180 | file = fopen(filename, "r"); 181 | } 182 | 183 | ~FileHandler() { 184 | if (file != nullptr) { 185 | fclose(file); 186 | } 187 | } 188 | }; 189 | ``` -------------------------------------------------------------------------------- /Languages/C#/Notes/08_Advanced_Topics.md: -------------------------------------------------------------------------------- 1 | # Advanced Exception Handling 2 | Exception handling in C# involves more than just using `try`, `catch`, and `finally` blocks. There are advanced concepts and practices that can help you write robust and reliable code. Here are some advanced topics related to exception handling in C#: 3 | ## Custom Exceptions 4 | - You can create custom exception classes by deriving from `System.Exception` to represent application-specific errors. 5 | - Custom exceptions allow you to provide more context and information about errors that occur in your application. 6 | ```cs 7 | class MyCustomException : Exception 8 | { 9 | public MyCustomException(string message) : base(message) 10 | { 11 | } 12 | } 13 | ``` 14 | ## Exception Filters 15 | - Exception filters allow you to catch exceptions only if a specific condition is met. 16 | - They are introduced with the `when` keyword. 17 | ```cs 18 | try 19 | { 20 | // Code that may throw exceptions. 21 | } 22 | catch (Exception ex) when (ex.Message.Contains("specific condition")) 23 | { 24 | // Handle the exception if the condition is met. 25 | } 26 | ``` 27 | ## AggregateException 28 | - An `AggregateException` is used when multiple exceptions are thrown concurrently (e.g., in parallel processing) and you need to handle all of them. 29 | - It contains a collection of inner exceptions. 30 | ```cs 31 | try 32 | { 33 | // Code that may throw multiple exceptions concurrently. 34 | } 35 | catch (AggregateException ex) 36 | { 37 | foreach (var innerException in ex.InnerExceptions) 38 | { 39 | // Handle each inner exception. 40 | } 41 | } 42 | ``` 43 | ## UnobservedTaskExceptions 44 | - When dealing with asynchronous code using tasks, unhandled exceptions can lead to application crashes. 45 | - You can subscribe to the `TaskScheduler.UnobservedTaskException` event to handle unobserved task exceptions and prevent application termination. 46 | ```cs 47 | TaskScheduler.UnobservedTaskException += (sender, e) => 48 | { 49 | // Handle unobserved task exceptions. 50 | e.SetObserved(); 51 | }; 52 | ``` 53 | ## Exception Logging 54 | - Logging exceptions, along with contextual information, is crucial for debugging and monitoring applications. 55 | - Logging libraries like Serilog, NLog, or built-in logging mechanisms can be used to log exceptions. 56 | ## Using `throw` in `finally` block 57 | - Be cautious when using `throw` within a `finally` block, as it can suppress exceptions that occurred in the corresponding `try` or `catch` blocks. 58 | ## Handling Specific Exceptions 59 | It's generally better to handle specific exceptions rather than catching the base `System.Exception` class, as it allows you to provide more targeted error handling. 60 | 61 | # Multithreading and Asynchronous Programming 62 | Multithreading and asynchronous programming are essential for building responsive and high-performance applications in C#. These techniques allow you to execute tasks concurrently, making efficient use of CPU resources. 63 | ## Multithreading 64 | - Multithreading involves running multiple threads of execution within a single process. 65 | - Threads are lightweight units of execution that can perform tasks concurrently. 66 | - In C#, you can work with threads using the `System.Threading` namespace. 67 | ```cs 68 | using System; 69 | using System.Threading; 70 | 71 | class Program 72 | { 73 | static void Main() 74 | { 75 | Thread thread1 = new Thread(() => 76 | { 77 | for (int i = 0; i < 5; i++) 78 | { 79 | Console.WriteLine("Thread 1: " + i); 80 | } 81 | }); 82 | 83 | Thread thread2 = new Thread(() => 84 | { 85 | for (int i = 0; i < 5; i++) 86 | { 87 | Console.WriteLine("Thread 2: " + i); 88 | } 89 | }); 90 | 91 | thread1.Start(); 92 | thread2.Start(); 93 | 94 | // Wait for both threads to finish. 95 | thread1.Join(); 96 | thread2.Join(); 97 | } 98 | } 99 | ``` 100 | ## Task Parallel Library (TPL) 101 | - TPL is a higher-level abstraction for managing tasks and parallelism in C#. 102 | - The `Task` class represents an asynchronous operation or task. 103 | ```cs 104 | using System; 105 | using System.Threading.Tasks; 106 | 107 | class Program 108 | { 109 | static async Task Main() 110 | { 111 | Task task1 = Task.Run(() => 112 | { 113 | Console.WriteLine("Task 1 is running."); 114 | }); 115 | 116 | Task task2 = Task.Run(() => 117 | { 118 | Console.WriteLine("Task 2 is running."); 119 | }); 120 | 121 | await Task.WhenAll(task1, task2); 122 | } 123 | } 124 | 125 | ``` 126 | ## Asynchronous Programming 127 | - Asynchronous programming allows you to write non-blocking code that improves the responsiveness of your application. 128 | - The `async` and `await` keywords are used to work with asynchronous methods. 129 | ```cs 130 | using System; 131 | using System.Threading.Tasks; 132 | 133 | class Program 134 | { 135 | static async Task Main() 136 | { 137 | await Task.Delay(1000); // Simulate asynchronous operation. 138 | Console.WriteLine("Task completed after delay."); 139 | } 140 | } 141 | ``` 142 | ## Synchronization and Locking 143 | - Multithreading can introduce synchronization issues and race conditions. 144 | - Techniques like locks (`lock` keyword) and other synchronization primitives are used to ensure thread safety. 145 | ## Thread Safety Patterns 146 | Design patterns like the Producer-Consumer pattern and the Reader-Writer pattern help manage concurrent access to resources. 147 | ## Cancelation Token 148 | `CancellationToken` allows you to cancel long-running tasks gracefully. 149 | ## Parallel LINQ(PLINQ) 150 | PLINQ is an extension of LINQ that allows for parallel execution of LINQ queries, improving performance for data-intensive operations. 151 | -------------------------------------------------------------------------------- /Languages/C#/Notes/01_Basic_Concepts.md: -------------------------------------------------------------------------------- 1 | >In C#, variables are used to store and manage data in your programs. Data types define the kind of data a variable can hold. 2 | # Variables & Datatypes 3 | ## Variables 4 | - A variable is a symbolic name for a value in your program's memory. 5 | - You declare variables using a data type followed by a variable name 6 | ```Cs 7 | int age; // Declares an integer variable named 'age.' 8 | ``` 9 | ## Data Types 10 | - **Integers:** 11 | 12 | - `int`: Represents whole numbers (e.g., -5, 0, 42). 13 | - `long`: Used for large integer values. 14 | - `short` and `byte`: For smaller integer values with limited range. 15 | - **Floating-Point Numbers:** 16 | 17 | - `float`: Represents single-precision floating-point numbers. 18 | - `double`: Represents double-precision floating-point numbers (commonly used). 19 | - `decimal`: Used for financial calculations where precision is essential. 20 | - **Text:** 21 | 22 | - `char`: Represents a single character (e.g., 'A', '1'). 23 | - `string`: Represents a sequence of characters (text). 24 | - **Boolean:** 25 | 26 | - `bool`: Represents a binary value, either `true` or `false`. 27 | - **Other Data Types:** 28 | 29 | - `DateTime`: Represents dates and times. 30 | - `enum`: Used to define a set of named integer constants. 31 | - `object`: The base type for all types in C# (used for generalization). 32 | ## Variable Initialization 33 | ```cs 34 | int score = 100; // Initializes 'score' with the value 100. 35 | ``` 36 | ## Type Interface (var) 37 | C# supports type inference using the `var` keyword. The compiler determines the data type based on the assigned value: 38 | ```cs 39 | var playerName = "Alice"; // 'playerName' is inferred as a string. 40 | ``` 41 | ## Constance 42 | You can declare constants using the `const` keyword. Constants have fixed values that cannot be changed during program execution: 43 | ```cs 44 | const double PI = 3.14159265359; 45 | ``` 46 | # Operators 47 | 48 | >Operators are symbols or keywords that perform operations on variables and values. C# supports various types of operators for different purposes. 49 | ## Arithmetic Operators 50 | Arithmetic operators perform mathematical operations on numeric values: 51 | 52 | - `+` (Addition) 53 | - `-` (Subtraction) 54 | - `*` (Multiplication) 55 | - `/` (Division) 56 | - `%` (Modulus, returns the remainder) 57 | ```cs 58 | int x = 10; 59 | int y = 5; 60 | int result = x + y; // 'result' will be 15. 61 | ``` 62 | ## Comparison Operators 63 | Comparison operators are used to compare values and return a Boolean result (`true` or `false`): 64 | 65 | - `==` (Equal to) 66 | - `!=` (Not equal to) 67 | - `<` (Less than) 68 | - `>` (Greater than) 69 | - `<=` (Less than or equal to) 70 | - `>=` (Greater than or equal to) 71 | ```cs 72 | int a = 7; 73 | int b = 5; 74 | bool isGreaterThan = a > b; // 'isGreaterThan' will be true. 75 | ``` 76 | ## Logical Operators 77 | Logical operators perform logical operations on Boolean values: 78 | 79 | - `&&` (Logical AND) 80 | - `||` (Logical OR) 81 | - `!` (Logical NOT) 82 | ```cs 83 | bool hasMoney = true; 84 | bool hasTime = false; 85 | bool canGoShopping = hasMoney && !hasTime; // 'canGoShopping' will be true. 86 | ``` 87 | ## Assignment Operators 88 | Assignment operators are used to assign values to variables: 89 | 90 | - `=` (Assignment) 91 | - `+=` (Add and assign) 92 | - `-=` (Subtract and assign) 93 | - `*=` (Multiply and assign) 94 | - `/=` (Divide and assign) 95 | ```cs 96 | int count = 10; 97 | count += 5; // 'count' will be 15. 98 | ``` 99 | ## Increment and Decrement Operators 100 | Increment and decrement operators change the value of a variable by 1: 101 | 102 | - `++` (Increment) 103 | - `--` (Decrement) 104 | ```cs 105 | int counter = 5; 106 | counter++; // 'counter' will be 6. 107 | ``` 108 | ## Ternary Operator (Conditional Operator) 109 | The ternary operator (`? :`) is a shorthand way to write an `if-else` statement in a single line: 110 | ```cs 111 | int age = 18; 112 | string message = (age >= 18) ? "Adult" : "Minor"; 113 | ``` 114 | # Control Flow in C# 115 | Control flow refers to the order in which statements are executed in a program. In C#, you can control the flow of your program's execution using various control structures. 116 | ## Conditional Statements 117 | - **if Statement:** The `if` statement is used for conditional branching. It executes a block of code if a specified condition is true. 118 | ```cs 119 | int age = 20; 120 | if (age >= 18) 121 | { 122 | Console.WriteLine("You are an adult."); 123 | } 124 | ``` 125 | - **if-else Statement:** The `if-else` statement allows you to execute different code blocks based on a condition. 126 | ```cs 127 | int score = 75; 128 | if (score >= 60) 129 | { 130 | Console.WriteLine("You passed."); 131 | } 132 | else 133 | { 134 | Console.WriteLine("You failed."); 135 | } 136 | ``` 137 | - **switch Statement:** The `switch` statement is used for multi-branching based on the value of an expression. 138 | ```cs 139 | char grade = 'B'; 140 | switch (grade) 141 | { 142 | case 'A': 143 | Console.WriteLine("Excellent!"); 144 | break; 145 | case 'B': 146 | Console.WriteLine("Good job!"); 147 | break; 148 | default: 149 | Console.WriteLine("Try harder next time."); 150 | break; 151 | } 152 | ``` 153 | ## Looping Statement 154 | - **for Loop:** The `for` loop is used for executing a block of code a specific number of times. 155 | ```cs 156 | for (int i = 0; i < 5; i++) 157 | { 158 | Console.WriteLine("Iteration " + i); 159 | } 160 | ``` 161 | - **while Loop:** The `while` loop executes a block of code as long as a specified condition is true. 162 | ```cs 163 | int count = 0; 164 | while (count < 3) 165 | { 166 | Console.WriteLine("Count: " + count); 167 | count++; 168 | } 169 | ``` 170 | - **do-while Loop:** The `do-while` loop is similar to the `while` loop, but it guarantees that the block of code is executed at least once. 171 | ```cs 172 | int num = 5; 173 | do 174 | { 175 | Console.WriteLine("Number: " + num); 176 | num--; 177 | } while (num > 0); 178 | ``` 179 | ## Jump Statements 180 | - **break:** The `break` statement is used to exit a loop or switch statement prematurely. 181 | - **continue:** The `continue` statement skips the remaining code in the current iteration of a loop and continues to the next iteration. 182 | ## Conditional Ternary Operator 183 | ![[#Ternary Operator (Conditional Operator)]] 184 | 185 | ```cs 186 | // Example Code 187 | using System; 188 | 189 | public class Example{ 190 | 191 |     static public void Main (){ 192 | 193 |         string input = Console.ReadLine(); 194 |         // Check if the input is a valid integer value. 195 | 196 |         if (Int32.TryParse(input, out int gameCount)) 197 | 198 |         { 199 | 200 |             Console.WriteLine("Your game count is: " + gameCount); 201 | 202 |         } 203 | 204 |         else 205 | 206 |         { 207 | 208 |             Console.WriteLine("Invalid input. Please enter an integer value."); 209 | 210 |         } 211 | 212 |     } 213 | 214 | } 215 | 216 | ``` -------------------------------------------------------------------------------- /Game_Dev_Companies_Info.md: -------------------------------------------------------------------------------- 1 | # Small Companies 2 | ## Aaryavarta Technologies (Pune, Maharashtra) 3 | #### Contact 4 | Info; 5 | Email : info@aaryavarta.com 6 | Contact : +91 9545524075 7 | Contact : +91 9822000891 8 | Website : [Aaryavartra](https://www.aaryavarta.com/) 9 | 10 | ## BR Softech (Jaipur, Rajasthan) 11 | #### Contact 12 | Email : -  [nitin@brsoftech.com](mailto:nitin@brsoftech.com) 13 | Contact : [+919982201414](tel:+919982201414) 14 | Website : [BR Softech](https://www.brsoftech.com/ludo-game-development.html) 15 | Address : 90, Usha Vihar, Triveni Nagar, Gopalpura Bypass,Jaipur, Rajasthan 302018 16 | 17 | ## StudioKrew (New Delhi, Delhi) 18 | #### Contact 19 | Email : [hello@studiokrew.com](mail:hello@studiokrew.com) 20 | Contact : [+91 882 661 7711](tel:+918826617711) 21 | Website : [StudioKrew](https://studiokrew.com/) 22 | Address : LoudMedics LLP. 23 | 2, Shambhu Dayal Bagh, 24 | Opp. Okhla NSIC Metro Station 25 | New Delhi, India 110020 26 | ## Gameberry Labs (Hyderabad, Telangana)\ 27 | #### Contact 28 | Website : [Gameberry](https://gameberrylabs.com/) 29 | Email : Support@gameberrylabs.com 30 | Address : Gameberry Labs, Golden Tower, HSR Sector 1, Bangalore 31 | 32 | ## Xplored (Bengaluru, Karnataka) 33 | #### Contact 34 | // Not Found 35 | ## Pixalot Labs (Ahmedabad, Gujarat) 36 | #### Contact 37 | Address : Pixalot Labs, Plot no 186, Road no 15 Jubilee Hills, Hyderabad-500033, India. 38 | Website : [Pixalot Labs](https://pixalotlabs.com/) 39 | Contact : +91 800089 6333 40 | Email : Contact@pixalotlabs.com 41 | ## The Game Bakers (Indore, Madhya Pradesh) 42 | #### Contact 43 | Website : [The Game Bakers](https://thegamebakers.com) 44 | X Handle : [@thegamebakers](http://www.twitter.com/thegamebakers) 45 | 46 | ## GameMonk (Chandigarh, Punjab) 47 | #### Contact 48 | Email : feedback.gamemonkstudio@gmail.com 49 | Website : [Game Monk]([http://gamemonkstudio.com/](http://gamemonkstudio.com/)) 50 | ## Level9 Studios (Kolkata, West Bengal) 51 | #### Contact 52 | Email : info@level9gamestudio.com 53 | Website : [Level9 Studios]([http://level9gamestudio.com/](http://level9gamestudio.com/)) 54 | } 55 | ## 7th Sense Interactive (Chennai, Tamil Nadu) 56 | #### Contact 57 | // Not Sure 58 | Link :[Google Maps Link](https://www.google.com/maps/place/Seventhsense+Technologies+Pvt.+Ltd/@12.9860264,80.0965656,12z/data=!4m10!1m2!2m1!1s7th+Sense+Intreactive+Chennai,+Tamil+Nadu!3m6!1s0x3a5267003f157435:0x6cf24fb86e91bc53!8m2!3d12.9860264!4d80.2490009!15sCik3dGggU2Vuc2UgSW50cmVhY3RpdmUgQ2hlbm5haSwgVGFtaWwgTmFkdZIBEHNvZnR3YXJlX2NvbXBhbnngAQA!16s%2Fg%2F12hkxgb9w?entry=ttu) 59 | ## Playghem (Kochi, Kerala) 60 | #### Contact 61 | // Not Found 62 | 63 | ## Gamezop (Gurugram, Haryana) 64 | #### Contact 65 | Website : [GameZop](https://www.gamezop.com/) 66 | Email : business@gamezop.com 67 | 68 | # Big Companies 69 | ## Juego Studios (Bengaluru, Karnataka) 70 | #### Contact 71 | Address : GR Grand Plaza, 2nd Floor, JP Nagar 6th Phase, 72 | Bangalore – 560 078 India 73 | Contact : [_+91 89298-08414_](tel://+918929808414) 74 | Email : [info@juegostudio.com](mailto:info@juegostudio.com) 75 | Website : [Juego Studios](https://www.juegostudio.com/) 76 | 77 | ## Tech Mahindra (Pune, Maharashtra) 78 | #### Contact 79 | // Not Focusing 80 | Website : [Tech Mahindra](https://www.techmahindra.com/en-in/?f=3828851747) 81 | 82 | ## HData Systems (Hyderabad, Telangana) 83 | 84 | #### Contact 85 | Address : C-308, Ganesh Meridian, Near Sola Bridge, Opp Gujarat High Court, S.G. Highway, Ahmedabad 380061, Gujarat, India 86 | Phone : [+91 8000-161-161](tel:+13097914105 "Give me a call") 87 | 88 | ## Valtech (Bengaluru, Karnataka) 89 | #### Contact 90 | Address : Unitech Cyber Park, tower B,8th floor, Sector 39, Gurugram, Haryana 122022 91 | Website : [Valtech](https://www.valtech.com/en-in/) 92 | 93 | ## Accenture (Bengaluru, Karnataka) 94 | #### Contact 95 | Website : [Accenture](https://www.accenture.com/in-en/about/contact-us#accordion-fbfef6a902-item-6803fc301e) 96 | 97 | - ## Capgemini (Mumbai, Maharashtra) 98 | #### Contact 99 | Website : [LinkedIn Profile](https://www.linkedin.com/jobs/view/game-developer-f-m-d-at-capgemini-engineering-3708700824/?originalSubdomain=de) 100 | // No Longer Hiring 101 | # Startups 102 | ## Nodwin Gaming (Bengaluru, Karnataka) 103 | #### Contact 104 | Email : social@nodwin.com 105 | Phone : +91-124-4227198 106 | Website : [Nodwin Gaming](https://nodwingaming.com/) 107 | ## PlaySimple Games (Bengaluru, Karnataka) 108 | #### Contact 109 | Address : No 147, 2nd floor, Anjaneya Techno Park, Kodihalli, HAL Old Airport Road, Bangalore , Karnataka - 560 008 110 | Website : [PlaySimple](https://careers.playsimple.in/jobs/Careers) 111 | Email : [resumes@playsimple.zohorecruitmail.in](mailto:resumes@playsimple.zohorecruitmail.in?subject=Application%20for%20PlaySimple%20Games&body=Dear%20recruiter,I%27ve%20attached%20my%20resume%20for%20your%20consideration%20so%20you%20know%20which%20teams%20most%20closely%20match%20my%20skills%20and%20interests.%20Looking%20forward%20to%20talking%20to%20you.) 112 | ## Dream11 (Gurugram, Haryana) 113 | #### Contact 114 | Contact : [LinkedIn Profile](https://www.linkedin.com/jobs/dream11-jobs-mumbai/?currentJobId=3646552503&originalSubdomain=in) 115 | Website : [Dream11](https://www.dream11.com/) 116 | ## MPL (Bengaluru, Karnataka) 117 | #### Contact 118 | Website : [MPL](https://help.mpl.live/) 119 | ## Nazara Technologies (Mumbai, Maharashtra) 120 | #### Contact 121 | Email :  [HR](mailto:sonal.navale@nazara.com) 122 | Address :  Nazara Technologies Ltd., 51-54, Maker Chambers III, Nariman Point, Mumbai 400021 CIN: L72900MH1999PLC122970 123 | Phone : +91-22-40330800 124 | Website : [Nazara](https://www.nazara.com/?page_id=1653) 125 | ## Gameloft India (Bengaluru, Karnataka) 126 | #### Contact 127 | X Handle : [GameLoft IN](https://twitter.com/gameloftin) 128 | ## Ubisoft India (Pune, Maharashtra) 129 | #### Contact 130 | Website : [Ubisoft IN](https://www.ubisoft.com/en-us/company/careers/search?query=Game%2520De&countries=in) 131 | Address : Kumar Cerebrum IT Park, B3-5th floor, Behind Gold Adlabs, Kalyaninagar, Pune - 411014, Maharashtra 132 | ## Zynga India (Bengaluru, Karnataka) 133 | #### Contact 134 | Website : [Zynga IN](https://www.zynga.com/international-location/bengaluru-india/) 135 | Address : 4th & 5th Floor, Prestige Falcon Tower, Municipal no 19, Brunton Rd, Craig Park Layout, Richmond Town, Bengaluru, Karnataka 560025 136 | ## Electronic Arts India (Bengaluru, Karnataka) 137 | #### Contact 138 | Address : C9PP+383, Vega Block, Ascendas IT Park, Hitech City, Hyderabad, Telangana 500081 139 | Phone : 04040365100 140 | Website : [EA](https://ea.gr8people.com/jobs?geo_location=ChIJx9Lr6tqZyzsRwvu6koO3k64) 141 | ## Rovio India (Bengaluru, Karnataka) 142 | #### Contact 143 | // Shutdown After the merge 144 | ## Rockstar Games India (Bengaluru, Karnataka) 145 | #### Contact 146 | Website: [Rockstar Games](https://www.rockstargames.com/careers/offices/rockstar-india) 147 | Profile : [LInkedIN](https://www.linkedin.com/in/nikhil-nath-singh-914368a5/?originalSubdomain=in) 148 | # Other Companies 149 | - Aceviral Technologies (Bengaluru, Karnataka) 150 | - Agate Games (Pune, Maharashtra) 151 | - Aksys Games (Bengaluru, Karnataka) 152 | - Anibrain (Bengaluru, Karnataka) 153 | - Applause Entertainment (Mumbai, Maharashtra) 154 | - Arcana Studios (Bengaluru, Karnataka) 155 | - Armchair Studios (Bengaluru, Karnataka) 156 | - Astropad Studios (Noida, Uttar Pradesh) 157 | - Binary Square (Bengaluru, Karnataka) 158 | - Black Sheep Entertainment (Hyderabad, Telangana) 159 | - BlueStacks (Bengaluru, Karnataka) 160 | - Chaos Theory Games (Pune, Maharashtra) 161 | - Creative Monkey Games (Bengaluru, Karnataka) 162 | - Dhruva Interactive (Bengaluru, Karnataka) 163 | - Eikoh Studios (Bengaluru, Karnataka) 164 | - Eloquent Games (Bengaluru, Karnataka) 165 | - GameEon (Bengaluru, Karnataka) 166 | - GamezKraft (Bengaluru, Karnataka) 167 | - Gamitronics (Bengaluru, Karnataka) 168 | - Gamezop (Gurugram, Haryana) 169 | - Genieee (Ahmedabad, Gujarat) 170 | - Gravit Game Studios (Bengaluru, Karnataka) 171 | - HopFrog (Bengaluru, Karnataka) 172 | - Hyperlink InfoSystem (Ahmedabad, Gujarat) 173 | - IGG India (Bengaluru, Karnataka) 174 | - Infinite Studios (Bengaluru, Karnataka) 175 | - Jupiter Entertainment (Bengaluru, Karnataka) 176 | - Kmphitech (Bengaluru, Karnataka) 177 | - Moonfrog Labs (Bengaluru, Karnataka) 178 | - Nazara Technologies (Mumbai, Maharashtra) 179 | - Nautilus Mobile (Bengaluru, Karnataka) 180 | - Next Wave Multimedia (Bengaluru, Karnataka) 181 | - Nodwin Gaming (Bengaluru, Karnataka) 182 | - Octro Interactive (Pune, Maharashtra) 183 | - OneUp Games (Bengaluru, Karnataka) 184 | - PlaySimple Games (Bengaluru, Karnataka) 185 | - Rovio India (Bengaluru, Karnataka) 186 | - Samosa Labs (Bengaluru, Karnataka) 187 | - Second Gear Studios (Bengaluru, Karnataka) 188 | - Synarion IT Solutions (Bengaluru, Karnataka) 189 | - The Game Bakers (Indore, Madhya Pradesh) 190 | - The Indie Game Studio (Bengaluru, Karnataka) 191 | - Unit5 (Bengaluru, Karnataka) 192 | - Vuclip (Mumbai, Maharashtra) 193 | - Zapak Digital Entertainment (Mumbai, Maharashtra) 194 | 195 | 196 | 197 | -------------------------------------------------------------------------------- /Languages/C++/Notes/08_Advanced_Topics.md: -------------------------------------------------------------------------------- 1 | # Templates and Generic Programming 2 | Templates and generic programming in C++ are powerful features that allow you to write code that works with different data types without duplicating code. Templates enable you to create functions, classes, and data structures that are parameterized with one or more data types or values. This results in more flexible and reusable code. 3 | ## Function Templates 4 | - Function templates allow you to define a generic function that can work with various data types. 5 | - You specify the data type as a template parameter. 6 | ```cpp 7 | template 8 | T add(T a, T b) { 9 | return a + b; 10 | } 11 | 12 | int main() { 13 | int result1 = add(5, 3); // Calls add 14 | double result2 = add(2.5, 3.7); // Calls add 15 | return 0; 16 | } 17 | ``` 18 | ## Class Templates 19 | - Class templates are similar to function templates, but they allow you to create generic classes. 20 | - Template parameters can represent data types or values. 21 | ```cpp 22 | template 23 | class MyContainer { 24 | public: 25 | T data; 26 | MyContainer(T value) : data(value) {} 27 | }; 28 | 29 | int main() { 30 | MyContainer container1(42); // Uses int as the type parameter 31 | MyContainer container2(3.14); // Uses double as the type parameter 32 | return 0; 33 | } 34 | ``` 35 | ## Template Specialization 36 | - Template specialization allows you to provide specialized implementations for specific data types. 37 | - This can be useful when you want to optimize or customize behavior for certain types. 38 | ```cpp 39 | template 40 | class MyContainer { 41 | public: 42 | T data; 43 | MyContainer(T value) : data(value) {} 44 | }; 45 | 46 | // Specialization for the string data type 47 | template <> 48 | class MyContainer { 49 | public: 50 | std::string data; 51 | MyContainer(std::string value) : data("Specialized: " + value) {} 52 | }; 53 | ``` 54 | ## Non-Type Template Parameters 55 | - Non-type template parameters allow you to use values, not just types, as template parameters. 56 | - They are useful for creating templates that depend on constants or compile-time values. 57 | ```cpp 58 | template 59 | class FixedSizeArray { 60 | public: 61 | int data[N]; 62 | FixedSizeArray() { 63 | for (int i = 0; i < N; ++i) { 64 | data[i] = 0; 65 | } 66 | } 67 | }; 68 | 69 | int main() { 70 | FixedSizeArray<5> arr; // Creates an array of size 5 71 | return 0; 72 | } 73 | ``` 74 | ## Generic Algorithms 75 | - C++ Standard Library provides generic algorithms that work with various containers and data types. 76 | - Examples include `std::sort`, `std::find`, `std::transform`, and more. 77 | ```cpp 78 | std::vector numbers = {3, 1, 4, 1, 5, 9}; 79 | std::sort(numbers.begin(), numbers.end()); 80 | ``` 81 | >Templates and generic programming in C++ promote code reusability, flexibility, and maintainability. They allow you to write highly versatile code that can adapt to different data types and values, reducing the need for code duplication and increasing the overall efficiency of your programs. 82 | # Lambda Expression 83 | Lambda expressions, often referred to as "lambdas," are a powerful feature introduced in C++11 that allow you to create anonymous, inline functions. Lambdas are particularly useful for defining short, one-time-use functions without the need for explicitly declaring a separate function or function object. They are often used in modern C++ for tasks like sorting, filtering, and transforming data within algorithms and containers. 84 | ```cpp 85 | [capture_clause](parameter_list) -> return_type { 86 | // Lambda body 87 | } 88 | ``` 89 | ## Capture Clause (Optional) 90 | - The capture clause allows you to specify which variables from the surrounding scope the lambda can access. 91 | - Variables can be captured by value (`[var]`) or by reference (`[&var]`). 92 | - You can also capture multiple variables and mix capture modes. 93 | ```cpp 94 | int x = 10; 95 | auto lambda = [x]() { 96 | // 'x' is captured by value 97 | std::cout << x << std::endl; 98 | }; 99 | ``` 100 | ## Parameter List (Optional) 101 | - Like regular functions, lambdas can have parameters that are used within the lambda body. 102 | - Parameters are defined within parentheses. 103 | ```cpp 104 | auto add = [](int a, int b) { 105 | return a + b; 106 | }; 107 | ``` 108 | ## Return Type (Optional) 109 | In most cases, the return type of a lambda can be deduced by the compiler. However, you can specify it explicitly using the `->` operator. 110 | ```cpp 111 | auto multiply = [](int a, int b) -> int { 112 | return a * 113 | ``` 114 | ## Lambda Body 115 | - The lambda body contains the code that gets executed when the lambda is invoked. 116 | - It can include any valid C++ code, just like a regular function. 117 | **Using Lambda Expressions:** 118 | You can assign lambda expressions to variables and invoke them as if they were functions. 119 | ```cpp 120 | int main() { 121 | int x = 5; 122 | 123 | // Lambda captures 'x' by value and takes no parameters 124 | auto lambda = [x]() { 125 | std::cout << "Captured value: " << x << std::endl; 126 | }; 127 | 128 | lambda(); // Invoke the lambda 129 | 130 | return 0; 131 | } 132 | 133 | ``` 134 | ## Lambda Expressions with Standard Algorithms 135 | Lambdas are often used with standard algorithms like `std::for_each`, `std::sort`, and `std::find_if` to customize their behavior. 136 | ```cpp 137 | #include 138 | #include 139 | #include 140 | 141 | int main() { 142 | std::vector numbers = {3, 1, 4, 1, 5, 9}; 143 | 144 | // Use a lambda to print each number 145 | std::for_each(numbers.begin(), numbers.end(), [](int num) { 146 | std::cout << num << " "; 147 | }); 148 | 149 | // Use a lambda to find the first even number 150 | auto even = std::find_if(numbers.begin(), numbers.end(), [](int num) { 151 | return num % 2 == 0; 152 | }); 153 | 154 | if (even != numbers.end()) { 155 | std::cout << "\nFirst even number: " << *even << std::endl; 156 | } 157 | 158 | return 0; 159 | } 160 | ``` 161 | >Lambda expressions make it easier to write concise and readable code by encapsulating functionality within the scope where it is needed. They are a powerful tool for working with algorithms, data transformations, and custom operations in modern C++. 162 | # Multithreading 163 | Multithreading is a powerful programming technique that allows a program to execute multiple threads concurrently. Each thread is an independent unit of execution, capable of running its code concurrently with other threads. Multithreading is especially useful for improving performance in applications that can benefit from parallelism, such as data processing, simulations, and user interfaces. 164 | 165 | > In C++, you can work with multithreading using the `` header and the `std::thread` class from the C++ Standard Library. Here's an overview of multithreading in C++: 166 | 167 | ## Creating Threads 168 | You can create threads by constructing objects of the `std::thread` class and passing a callable function or function object (like a lambda) that the thread will execute. 169 | ```cpp 170 | #include 171 | #include 172 | 173 | void threadFunction() { 174 | // Code to be executed by the thread 175 | std::cout << "Thread is running." << std::endl; 176 | } 177 | 178 | int main() { 179 | std::thread t1(threadFunction); // Create a new thread 180 | t1.join(); // Wait for the thread to finish 181 | 182 | std::cout << "Main thread continues." << std::endl; 183 | return 0; 184 | } 185 | ``` 186 | ## Managing Threads 187 | You can use member functions of the `std::thread` class to manage threads, such as `join()` to wait for a thread to finish and `detach()` to allow it to run independently. 188 | ```cpp 189 | std::thread t1(threadFunction); 190 | t1.join(); // Wait for t1 to finish 191 | 192 | std::thread t2(threadFunction); 193 | t2.detach(); // Allow t2 to run independently 194 | ``` 195 | ## Data Sharing and Synchronization 196 | - When multiple threads access shared data, you need to ensure proper synchronization to avoid data races and unpredictable behavior. 197 | - C++ provides various synchronization primitives like `std::mutex`, `std::lock_guard`, `std::unique_lock`, and others to protect shared resources. 198 | ```cpp 199 | #include 200 | #include 201 | #include 202 | 203 | std::mutex mtx; 204 | 205 | void threadFunction() { 206 | std::lock_guard lock(mtx); // Lock the mutex 207 | std::cout << "Thread is running." << std::endl; 208 | } // Automatically unlocks the mutex upon exiting the function 209 | 210 | int main() { 211 | std::thread t1(threadFunction); 212 | t1.join(); 213 | 214 | std::cout << "Main thread continues." << std::endl; 215 | return 0; 216 | } 217 | ``` 218 | ## Thread Safety 219 | It's essential to write thread-safe code when working with multithreading. Thread safety ensures that multiple threads can access shared data without causing conflicts or errors.. 220 | ## Asynchronous Operations 221 | C++ also provides asynchronous programming facilities using the `` header and classes like `std::async` and `std::future`. These allow you to execute functions asynchronously and retrieve their results. 222 | ```cpp 223 | #include 224 | #include 225 | 226 | int asyncFunction() { 227 | return 42; 228 | } 229 | 230 | int main() { 231 | std::future result = std::async(std::launch::async, asyncFunction); 232 | int value = result.get(); // Wait for the async task to complete and get the result 233 | 234 | std::cout << "Async result: " << value << std::endl; 235 | return 0; 236 | } 237 | ``` 238 | 239 | >Multithreading in C++ enables you to leverage the full power of modern CPUs by executing tasks concurrently. However, it also introduces challenges related to synchronization and coordination. Properly managing multithreaded code is essential to avoid issues like data races and deadlocks. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Game Development Knowledge Repository 2 | 3 | Welcome to the Game Development Knowledge Repository! 🎮✨ 4 | 5 | ![Game Development](data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxESEhUSExIWFhUXGBoVFRgXFhoWFxUXGRUXGBgaFRcbHSggGRolHhgYITEjJSkrLi4uFx8zODMsNygtLisBCgoKDg0OGxAQGy0mICUyKy0tLS0yLS0tLS8tLS0tLzIvLSsrLSstLS8tLy0tLS0tLy0tLS8tLS0tLy0tLS0vLf/AABEIALkBEAMBIgACEQEDEQH/xAAbAAABBQEBAAAAAAAAAAAAAAAAAgMEBQYBB//EAEEQAAIBAgQDBQUFBQcFAQEAAAECAAMRBBIhMQVBUQYTImFxMlKBkaEjQsHR8BRicpKxFTNTk6Oy4RYkVKLxggf/xAAbAQABBQEBAAAAAAAAAAAAAAAAAQIDBQYEB//EAD0RAAEDAwIDBAgDBwMFAAAAAAEAAhEDBCESMQVBURMiYXEGFDKBkbHR8FKhwSNCYpLS4fFTk6IVFiRysv/aAAwDAQACEQMRAD8AvYQhPNltkQhCCEQhCCEQhCCEQhCCEQhCCEQhCCEQhCCEQhCCEQhCCEQhCCEQhCCEQhCCEQhCCEQhCCEQhCCERSbj1iYpNx6xzd0hSYQhGpUQhCCEQnZyCEQhCCEQnZwa68osGCeQSTmEQiip6TgiHCVchImIx2ViMg009rr8I1/an7g/n/4l2PR+8gHuCYMGowHOcguwq4cTpHLWVCMiRSqkYMGCGEHPMFWEJX/2p+4P5/8AiVmN7TOjFRQUjr3g/KNdwK7aJJZ/uM/qTm8QY4x2dX30qo+bFo4TK/8AVlT/AMdf8wflO/8AVlT/AMdf8wflI/8Ao11/B/Oz+pSeuN/BU/2qv9C1MJWcG4t3w8S92wNrXuNgd/jJtfGqtVadiAVHiIBGa+vw21nJUtKlN7qboBbuJH5cilF2x2ggEh05gwI/FjunoDuZ6J6Ecyr7x+Q/OIqbHLqeVxYX89ZBoPh8R9V0yuQkLAY4uSjDKw+F5aChbNcE5VzjLseljtf8p1UOH167yym2SCB4ZmM7QYMH3Lku+IW1o0urPAEOPmGxMDcxI2TEIlKgKK5BW5yWYWIe17a+UVOerRqUiBUaRIkTjHVT0q9OrJpuDoJBggwRuDHMIhCEiUqIQhBCIQhBCIpNx6xMUm49Y5u6QpMIQjUqIQhBCYqYumpsTqPKJ/b6XvfQxztTxF6NLDlFJziorWZxocvuOuvnuOVtZdYXHdzhaLtoDTBbMXc3bXdiWOp5kzXUuH8O7NpdTqFxDZAduXRsAwnJOAqC4qcSpN7bXTFMl8S04DCZk9oBsDlUP9oUve+hj1Kqri6m/rJPFO1JBXuSpGXxeD71zfe3lKrjfEQ9cVabX8Cq2lgSL3Fj6yS94A3sibehV1AjeSCP5B88KvsvSAOrFtxXpaROw055QTUcD5QpWKdgpKLmPIf0lRwftA1NctUktm1J1VRpuu5I121lnTx1M21sfPl8ZD4rwoM2dBr94e8OvrKi19ZsKoZUYWOdtqaRPL94bfZVtUFvejtadQPa3BDXS0c5wfa6Ty2haTtWUp0sOpdqa5hZrE6LTIGb5iZ7G8ap03yjxiwOZSLa/jKfF+wf4vwMrwJbcbsaVvVNAgOxOrIPPGHRyxjCr+C39S6txXHdknu4IxznSCtBxBwzAjUGxHoSZW8XZ0oMynxhhlsoOh30Pwkx1OWmBvYD6mSuA8KxCVRnpNsR7N9crchvtLqnQt/WDVrVmNDDTOh5A1gBs+0QI5HDoBOE65rXbLS3dQFU92uSKZcASHOIB0zkn2Z57SoXYSn+0LUOIGqlbX8AsQb9Lxzi2Apiq9lFri19dLDzmlx1BgU+yIstjem2+Z/3fMTE9pwQdbj7Rj00NyPSQer217fV6tNwDABDaZbA9luDBEc/Z5qoueO8Re1lv2dalMd9zn/hkjZknr3uRwrtOHYLKgKLeyZ/bvmsufX1vGuKcFw75Ew4AYvY+1YLlNy2b8Jj8OjOwRQSzaAC5N/IX/r5z1H/APnnZ8Yesjuc1Uq19TlUZdh19YcTpWYcyC5jiNLQ3TBO2pwDRMHcyJ2C7eEXvE6RcTVNQAlxLy8xj2QdcR0BBgkkyFVY3hopWZPZsi+hSmqX+IUH1vO94jrZyLjY2M0vFcEuJwHd1mquDWPide7qCwaxAB5fmLaWni/aLgNXBvaozFD/AHbgnxa6g8gwHI/WV1Hg9m+r6vWqP7RoERpaCBgQHNcZAGQTJ36xM7iN2ykKtJrdB6guI6yQ4CJ2wvSKNdALFh8jH1cHY3nmHZ51OKbIWyd2+XMbm2ZN56Bg8E60xWGqnmORvazeunzhxT0fs7SzNw2o4OkABxbBJO2GtzEkeSjsOP3Ve+Fq9jC2CSW6hGMbuPOB7wrShRBJOQE7XI9nUa3/AFvIVdyymo1I1T3ppBbXVERmRSFsbMcl788+9rR6lUDAgMwv4SUaxF97ERFPKajor1KeVAS2YfaZQq3bMpXMRz3OXXaT+jN3SFF1DXoqHDXQ0kTJgQNUYzqkAwBuq30ttK5rMuNGuk2S5upzQYgd46tIdmGhgDyNUzBRWw6+JXFSoFIKgEsUzLqGJOwyXuffjWCxBIyt8D19fOL78BBkdgWJzgnMWJ+8Sd20HwHK0VRoIqd7VqCmmYKCQWLMdbKo1MrvSS8t7muDSztkAZkNjI704y1wBHvKs/ReyuLC1LbmRmIJcYgukR7OT3g5hIdqye6CXoS+/sxOo9rJ7J9rpKrE0AHIB52GkzYptOzv+LvotJ62zx+B+ijQialZQwTN4mBKi1s1uh2vOo4IuDcGNc3SY+/zUtOq1+y7CEIxSoik3HrExSbj1jm7pCkwhCNSohCEEK9SgrUqeYHQG1qj0+f7pF/jJfBMNT70eA7H2qzuNvdZiJmMVxLFIg7lxZfu5VNx5EjeS+xXHcRWxSpUYFSrE2UDYdRNtZcTovpspCZgD3x5rK3XD6rarqpIiSeW09YlWvZt1q1LkOO7SwvVqsDYW8Ss1mOu5F5e0qgIchFuFvtztzla9GiNM1Q+Yx+IP1zxtsNTBP2tS3IDG19Neveazr9VrGox3aGGzIgd7pmcR75VJbP7GiadSprd+KII9390xjsd32FxV0VctMkWHr6TEYHH2QhrkAG3M+nnN5iaajDYqzOb0j7VepWtvydjb1E85qYdsvhAJBDAEb2O1/xnBxl7Bc0jEAEHyggq99H6TzbllSpqJJBdEb+EnyUfGEZCNb5tLjcAaH01kWlTgtIglLN7Vzm0I36b3vL3geBovn72pktbL4lW+99/h85Df3NTiFcHEkR4c+a7qfD7fhlPs6JJaM9SJ+/vYR2Nu7Nr2sfkTLyh2hCsp7l/CSd9/C69POOHheC/x1/zVjFbs/hWNxi2XyWqlvqJb3XD7S6Ouo8yQBEeABzrE7Kvo8Vr06Qom3a4N1AONRzSQXE7BhjB8U5xDtCKjBu6cWFt/wB4np5zE9psZ3lQ+EjxE6+c1WI7L0rfZ41w1/vVEIt8AJieK0ClRqebNlZvF71r3PxtedHC+H2toKhoOJkAGRGA7/2PXwVbxG5Nd1OaAZBOQ9zp7pEQWN/VS+A4qrh3c5QGKXu6623GXoDf6CaPgvbZqNalUrLmQq9xTUZs2oFrsBbSZLhzkl7kk5CLk8gtgIjE+zQ/hP8AujalCk+41OaJxmBPsnnviArGmC2x1Cf3uZ/1GDaY2cRt+YC23aPtzTp06eGois1RqgfPXyuMpuCLhr31006zN8U43icRSxNMojhDawQ3sMxLDXRhbQyr7RAftNH6fz8/rGsXXZExZU2Jq5TboS4MjFOlVNOq5rS4wZj+MDC7q1qLcV6TSYYXAST/AKTnZiAcwduXiZrODVWp1GYC7d2dBuPEt9+ek2HB69bEUKqXdSCCoLaNYggEeq7+QmO4Ob1T/AfPmJvOyQ/vPRfxnfxh5bwuq4ctJ/5tWV4cxjuKU2kbznn7Dv8APmAdwoeBVlQ1lZu8DhXUm4sbnUeoIl9+0pUUFlIb02P4iRcSoWpVXKLMoa3vFbG/0aNUuJeNctwc1wQfZbyMyHq1Ku1tR/QRtzGAT8946clsX3VcOImTtmdhz2VnQUbc+nOTK603o93URmCt3iFCA6taxtm0N+hlM9RiWJJ63IN773B3vJ+AxecWPtf18xKy9tTQIc0/UH6KahUFYFjxBH3IgmPLfqtvw3HpXpioh0O4PtK3NWHIiU/Ef71/X8Jn8VhKubvMO7JV55Wyh/XW1/WQO1VSuKhDVCVIF7MLZraggHX+kr6dq1zgGkZ5HcfXw/RcdW3LH6ZSuK8UoiqGVS7oLKbjJfr1NpX8K4g1NjfVWN2HmeYkBEvJdGlLTsmMZp3+/wAlNSbpMha2m4YAg3B2hKfh9Ypp93mPxEuFN9RK2ozSVZsfqCIpNx6xMUm49Y1u6cUmEIRqVE6JydghN8Sxn2q2phaeQDQ3u299vO3whQd6NTv6Ng9iNRcajU26x6ut/p+ESBJxUNJ4NPBCh7EFuh23ioz9u+JK2VjS8j3e/wD7SRS7dY47mn/J/wAyNi8Grjb9eUrq1PulLNy28+kt6N/c3Dm06ZJeSAAOZOFwVLWjSBc8DSMk9AFoK/anFVUam5TKwsbLY2PxldSpTIVuI1zXokOQpYAqNBzttv8AGbDhq1GUltVtcDm3oJe8U9FOIMoiq+q17onSJ8cNJGT5gTyVLS9JuH0qoplpa137xiN4zmQMb5jnGY5i8CHF9mGx/Ayu/Z91I8iDLpai5cwOlr38orDcVwlNhUqMGI0XKC1vUja/5zFtqOAgAlaiszS0vjbdUlLsbiGN0QBf3jlI+FiZ3Edm8RSF2S45lfFb4b/Saqp22oMDlZtFuFCsv/sRHMBxA4pc61DlBI0AXXQ81JO+9xOtxrCn2j3BrZgFzSNXkGhzveYBONwYqPWHB0BvmBy8ySB7hJ57ELFUaUax/DM3iVbnmOvp5zUcU4UysGRSwYnNYaqd72tsfofWNLgKnuN8v+JPb3bKDu0o3AaT0Dh8cfe6me1lwzTVpyPEtwfisfRwq+6By2Akynw9Da67bbeH0l/X4Q51FNr89N5xOG1f8NvlO/8A6yZ1G6J8BIJ8JMAeeY6HZc/qNIDS2kweemPgN+sYkgZG4qn4VSdgzKCeumnpHRwOgb3TfU7anz6y2Th1T3D8pKw/DnJAKkDmTyldU49eEl3bEeAOB5eC7G2FmG5Y0+cEnEZ6mNz+mFQJ2cww2pkehtJ+DwVOkCEFr763JmqXA0l0ADabkc/jI+N4epF0Fj05GcNbjV1WBp1qri3oTI+nzTaFKypvDqdINPWAD9VRV8Or6MPQ8xcWNpmqfC6ytYIxPIgEgz0HheGoIorYhgq3GVDvqSMzDfLcEfD56il3GJpDIQVHs2Fih9OUueG2T3N774G4H73LO+PvZNvrkNPdbPKeXl4ryRsHVGrowHmpAj1CnaekDAlDlI/IiVHHuAqFNamtsurqNrc2UdRzH6M99wyppNRji7wO/u6+UD37KK1vmE6XiPHl7+nn8lRYfEMNVNmta9r/AEmc4pisQzMlUjXXQaHoR8pqMJhs4LZgqKLs5NlA9ZzF8Po1kPd1UqZQCcvtLpvbmJnKVWmx0kdMxt0zt7lYVxSLskalj6VKOu7I4DL4SN5M/ZipsfgeRHUSS1EEAEcuk7+1EHoUBrgNI5rlJJMoG3pGaFK2kkos4XuU7QnYpNx6zgE6m49ZE3dSlJhCEalROgzk7EOyAYMqHxDHsKgJChAMtlFiLakmGOxmQjLZgQGBHMEAi3zmeq4x+9YVlykm66WFuQvsel5OrnwpbkoX0CgD+gmhZaVLuu3UNb3bxzxviBtufeqXjLRwrh37A6AIAjIEmcTPKVZYfiKuSpXL57j58oz2gpk0GtuCD8NvxlbTp/rnfy6yyweL+62qnTXp0PlLS6saXA7m3uabtT2mXM8OrTyxIE7nI2IFTwriFxxa2q0azYbGkP6mMyBAnn3RAGDmCc5w5wHF+oIO+xvb0P65g6M8Wq30CAWuBba2wkPFcEVHDIfD03t8eknYXDZRpe/Wam99K+GGmK1NxcYw3S4GehJGkeME+ErPO9Fb2vWFKq0Bo3dIOPATqnpIGfahFIBSrMpNMVFeogF7oGuwA53HKS+PVkxFQd3Up1EzXW2HNMUqQDfZuTbMblflsOa0S0n8NanfLUA12M8wZxB9Oi6mGg6uf9tvovTHhoAcQe7MR4iDyn4ETzkCFjuJcL7pXZdVIFuo8QNj+c1HYAf9s3XO1r8jlS00B4ZTa2VVYG/S+wGo5aH6zmHwKUVIVVpruQP6/SQXd26rRYxzTLeeIPec7fycPvJqJZqcW8zMe4D5gpOIHhXNYm/isLjn5RH2Xu/6Z/KZXtJxjvWCUmORdyDbM3l5D8ZUrVf32/mP5yBti+o3UTE8lK2lhegWpe7/AKZ/Kc+y93/TP5TDpVf32/mMdWq/vN/MYhsSP3k8UD1Wz+y93/TP5RWHC5/CLDKfukC9xblMetR/eb5mW/ZqjUqYhVDG2pbW/hA13+A+MdTsHucGtMk7JH0dLS4nZXmIwTVk7sugYn2joLAg66byOOyBFvt0PXlpzsdZfVuHPfa/QggfQxzCcLN7vy5bkyztbOuHdk+3mTuS5oA23GD1wSVyC70N7r/yB/uqLtTg2SpTqKrNTCZBbKQh0sF2sLLz66dJB4TiDQJqHwhm0W17gi+tuu56GegVEDAgi4OhExnazA90q29ktp8joZq3UdDjUnqYxucee3Ly6KG2cK720XDeATzgZ5zmdz9VqsNXSsgZeYv5i8fSnaU3AVIo02/cH9Jc06ytsQetiDadLTIBXFUbpeW+JC8l7W4F6IrUKYJRaoqZVvpSYZhYcwpIH/58pC4K5GISrTQqioA1zcEZAGu22uht5eU23Gez1fEYt6isKaBVXMdbm2tlG9vPSVvEOy+KQ6VBUWw9lchNhyFzf0v85n32bgKsMJaScYyNus+GBsuivWrVIpscxupoGol0tJ3OnTpJ/DLhB3xhUdA3up9m5K/ugnQDykhqdrDynaNG0kuNpny+ZhaVrIACYRY6BACEgJUoCIpNx6xMUm49Yrd0FJhCEalROicnREdsUrd1kMV2HxlQ+LiLHU2BQm1+XtyxXhD01RK2JUsD4SBkNrAai510OukuD2iwQ0/a8P8A5yfnK3H8SwjsWXG4UZlCtmqIbAHddd56TTaykZY0Dlt5H9B8Fiaj31WaHuMTO/OCJ+BIPmq/G9j8XUcsMdkHJVpkKB/PqfOJwuHqYVu5rVTW55yLEX8rnSaGlx/AqoX9soaAD++TkLdZS45qdR81OoKq8mVg43OgIJ22ldxYB1MvcJJOTifr/hdvDGhhDGmA0YHL78956q6w1TSx1HKLqMqKWOwEqKeIZENhfnbnoCdIy9ZioFiQCAoYgjXW50A0+IlXw/gvrI7UuxJ7vMgDkZ64iPI7Lsv+Km3IYG7wNR9lpcYziIiTMzj2d4u8Nilf2Tra9jvbr+uk7jMSKSNUYMQoucozG3pM9msyMoN1sLqRbne487nToBIvaHGNUCM1IBUN85e1lLLmGQGzhgLWMV/Bv/L0NIDJHMT5QXDnjefAmAemjcVTZ9uWkmD+6/ME5nRGQJ5N2ktGRMq9qCjHu6lREJXJoWWrcA3pqRpa+oHSSa3FHrDxuzA8g1lPwGkxNFWuRoXa6m1UE1XzXU73QixN2seXO002DwxVFIUjTxKTmI+PMzou7KhYwaYEn8QY44xOZInJwYM50gBq4Laq65JLsRzbI3zHIGMDOREid1LUJ5x1QvnG6YjyrK03v8DP5QrAW/i74pYTpOqsUgjgWRXGgsbUaImQRkiW6TIkkwQ4YJMEHMQA+lqDixxmADOJgyMxAkFp2AwRhCrNV2BA71+vd6emZb/hMwqyz4Hje4rK/LZh+6d/z+Eis67aVwx7tgfnhPuKbqlJzRuQvToTP9p8ZXXDd7hrNbxsQRfuwpJK6anbTeZWlj+MtfLRY5TY/aJocobp0YH4zZvrBpiCfISqS2sDXZq7RjeUOcAfgtfxDij0qwDKO6I0N9T1O3L9dZX9uKbVcMHpstkbOc19RYqALDe5AsZma+L4rUpZ2os1PL3lzUS2W177X2kPidXiS0SGokU7hj4wy6EWOnnaRis13dcHZ8FLT4ZVt5qMr0yckS5p3GwGMdFY0qNSoqCq2YKoAUHwrYaeHn6mSV7P4djmNIBvfW6OD1DrY/WUS4nHgA9zuQAc25JsOXWSv2riYKjuGBY2XxjU2Le70B+Ul9cMBsOgeB+SDwcF5f2tKSZPeC1fAuIVqVb9lxDmoGUvQqm2ZlUgMlW2hdbg5uYPkZqiLzyTEY/Hd9SV6Ld6vipDMLjP9lcaW1zW1nqGELCmpqWDhQXsfCGt4tel7xzKoqHYjzELluLM24H7Rjp/C7VHmsV2poiliGA2ez+hNwfmRf4yvblHePY4V67MPZ9lf4Rz+JufjIwO3pMReFjq1R1PYn9VorYObSa128BdhCE4F1Iik3HrExSbj1jm7pCkwhCNSonZyEELHcQ7E0c96dLMHNrZmuGJ9dryXU7IcIoE0q9a1WwzBM7KlyvtEX8um80devUpqXp2zqLrcXB66el5jKNm75iiu1Q5iSTmVi4JIHmevX0lxbVLit7VUho6HJPL3R8T5KtuLOBrY0RMYGx/QfrhP8Q7FYWkwGQMrDNTdWazr1Hi8x8xJXDuHpSXIi2UEm1yd9948x+xopmuVu2n3QSdP10kuhqPORPrViyHvLvOeu8J1OiGmCAD5Qo3EEtSYjTTlpzHOUtZrIq1PvZnY3Oa+UAEE6g6Mdfe9JoeKC1Fz0H4iZFqhbUkEnNzvbrrLThFbSx/jqxy9mf0j4roqWgrMYSIAezIw72mgAEZAzqwRkDG5Wg4B2YOIRmpIWAbXN4eQ0FzY7j5xvG8BNJstWiw/iBsfTkfhHOzHHMTh1Ip1CFzXykAodB9w7fCxllxvtFUxYpioqrkv7N7MTbWx2ta253M7i6mWy0QffHzKsKLLxlaKhD6Z5mA4eYAAPw96zA4YFbMBcEhtdbEbSZUx9Rj3dKwce251C+g5mWSpYE9AT9JU8FT7IHmxLE9SSfwETglvSu3Pq3WWUwDnbb5AAY546LDcevatlRayhhz5z0jf4knPLKfo8FqOM2eq1tSQwFvQWjIrVaHizGrTHtA/wB4g635/r1ltRxlRAVVyAdOX6BjNSkBfyv6bzV1ra3qg0rhrA1xApxMmR+RnaIx8VmLa4vB+3tXPc5jS6rMaQAfPIjfc89hiJiOP0ijd2WLbLdTa/8A8jq9oKaoC6uGIuoykB+hUnkZk6jtTZlViAtQkWPMXF/W0n8OxFStVpio5YUksgJvlUbAeQJvKn/t+0cG0e9uefWAf/n8lbn0gum6qvd2EYPKT1xv987ZjXq61KjIDslM5SPU8zErQqprTr1FPRvEp9QZPXSx19k8hbUWgjZ7A30N+vK3OWTn8NoP9V0N088bHoRGZ/zOYjo8J43d2pv2vfqMFrfxNOS4HV3QOhE9IVj2f7WYkXpKwSquuQjNSqeYG4+BjydpcruWwWGDHKGU09ARfUDle/0EyXFF8dNxvmKafrylxhsQKy2ewqAaH3h5+cznE6D+HXPZUj3DsDnST056ZjynGFbcIuhxG17WqO+ME/iiPdPz96axvaOoHWgKOGWnkVMvcEs4IKs5q28L+nMDrHTxcPTeiaNHJUGXMqkOvmpto0YxFM6aLe49r8PONUfbIyi19P1eMdcVDpLRBEjY9R4fOczywOwWtNrTqMgwYkeP2emE23FcidwFpAoQQ4TMxtmdc1wQfZ1+Mm8Q7QEVab5KAVaauU7rw1GJKln0JtY7A78pCxXDblmAUk9QeSldTfzjuM4YXZfZy92qG973DXsPL8Zfet2L6oNM9wsdOoQdUDqMHfIzPsneKmla3DKThUA1jTEHG2efVWnZridsXVxgprnKhBTF+6QMoN0G97C3xbrNDxPj9auMpIVearpf+Ik3Mz/D+HrSzWJJY3N+vl5ScqzEcT4m+vVcKbzowANsR5DnK0tlZNpUxraNeZO/P4bIVY+w29I2BHmG0pwcFWPNJE5CEjTkRSbj1iYpNx6xzd0FJhCEalRCEIIRIGI4YhYuFGYixtpfUG/rpJ8I9j3MMtKJI2MeSqBg7ajb+kk0acm5YnJHmqTuo9EKPi8N3lNkvbMLX3tMpV4Q6HKzdbG2jAi1xNsBGsRh1cWPwPSTW92+iTGx/UR8k52rTDTGQfgQR+YBWYwWCKi173N9pNp4S/P6SV+zlTYx6mk6HXlXk5K25r83fL6LtOnymV4TVXxUTupJW/MXJ+c2dJJ5jjTao/r+c0HonWLalbpDcfzLIelVBr6VLrLoPuC2KZbDw36+Ei2puL/KRsVXSmC5te+h+8x90GZ1OK1gLZ/mAfqRF4MtVqXYk2HP9aTYVbxtBlSsSTzAMQ2BGPM/n75yjLQ3Ro0A1rYlpc2ZfJmXdY+4EALTDPq2axf2hbqbxSZkqCqSW18WltCLXk9aUdFCY5vHLprw4ukAzED6T95nK17+B2jmlobBIiZM/OPd8IUynlPisG0IBPxy+LfQzrKDa6qTe4Ns31tMxWq1KLsqMQOnKx8jG63EarCxc28rD+k2QrUKrm3GkzGOkHP+CsiRd0KFSxDxoLgT1luMHp1Gx8JKtMTiRUrog1ClmP8AFY/0tLJKczvAheunx/2ma1acx3pHWcboE/hHzctZ6OUWstHNH4j8mqTSYVRlawYbedvORxg8ptaOLTk+m2cWPtcj1mcNw9pkRG+wweuy0QpNdvM7bnb4qPTp6R5ae3lrFBY4qyI3DhtHwHl0UnZDn8z9UKsWBACOATlJUyAJBqYl0qWbVDsekmwdARYyalXLGuZAIdE4E4MiDuPGNxgqOpRD3NdJlsxkxkRkA58J2OQugzkTTS2kVIFKERSbj1iYpNx6xW7oKTCEI1KiEIQQiEIQQiEIQQiEIQQkugO8QtO0dhFlIQhBPLMd/eP/ABH8Z6oJ59xXgddajeG6knKQRYgm/wA5p/RivTp1Koe4CQ2JMTEz81nfSOhUqU6ehpMEzAncDoqWX3A6HhLdTb4CQBwev7n1H5zT4PCZEVeg19dz9Zccavafq/Z03AkkbEHAzy8YVVwayqiualRpAAxIIycc45T+XVNrSjy0o+tOOrTmQNRasNWX7S4ezK/UWPqP/v0lHNzxjAGrSKr7QIZfUf8AF5mf7AxP+Efmv5zY8H4hRNqG1HgFuMkDHLflGPcsjxiwresl9NhIdBwCc7HYHmudnh/3Kej/AOxptRTme4BwWslYPUXKFvuQbkhhyPnNUElD6QV6dS6BpuBhoBgzmXHcY5hXfAqFSlbOFRpEuJyIMQ0be4poJFqkeCToWUJcrsBKXXfedAnAsckcp6AJyEI1KiEIQSohCEEIik3HrExSbj1jm7pCkwhCNSohCEEIhCEEIhCEEIhCEEIhCEEIialMMLHaKgYoSKsq4bKfLkZwU5Pqi8YyScVCRlRFoTQSOhIsLOgRCUsJASOBIoCdEYSlhcCxQWKAio2U6FwLO2nIREqIQhESohCEEIhCEEIhCEEIik3HrExSbj1jm7pCkwhCNSohCEEIhCEEIhCEEIhCEEIhCEEIgYQghJKxOSOQiykhN5J3LFwhKISMsVadhCULonIQiIRCEIJUQhCCEQhCCEQhCCEQhCCERSbj1iYpNx6xzd0hX//Z) 6 | 7 | Are you passionate about game development? Whether you're a beginner or an experienced developer, this repository is your one-stop destination for all things related to game development, including programming languages, machine learning, artificial intelligence, and more. 8 | ## What You'll Find Here 9 | 10 | - **Programming Languages**: Explore a wide range of programming languages commonly used in game development, from C++ and Python to Java and C#. 11 | 12 | - **Machine Learning & AI**: Dive into the exciting world of machine learning and artificial intelligence as it relates to game development. Discover how AI can enhance gameplay, create intelligent NPCs, and improve user experiences. 13 | 14 | - **Game Development Roadmaps**: Get a clear path to becoming a proficient game developer. Our comprehensive roadmaps guide you through the essential skills and knowledge you need at every stage of your journey. 15 | 16 | - **Notes & Tutorials**: Access detailed notes and tutorials on various game development topics, from game design principles to rendering techniques and physics simulations. 17 | 18 | - **Code Examples**: Find practical code examples, snippets, and projects that demonstrate key game development concepts and best practices. 19 | 20 | ## Getting Started 21 | 22 | Ready to embark on your game development journey? Here's how you can get started: 23 | 24 | 1. Explore the [Programming Languages](https://github.com/XxAlonexX/Game-Dev-Notes/tree/main/Languages) directory to find language-specific resources and examples. 25 | 26 | 2. Dive into the [Machine Learning & AI](https://github.com/XxAlonexX/Game-Dev-Notes/tree/main/ML) section to discover how AI can take your games to the next level. 27 | 28 | 3. Check out our curated [Game Development Roadmaps](https://github.com/XxAlonexX/Game-Dev-Notes/blob/main/RoadMap%20(GD).md) for a step-by-step guide to mastering game development skills. 29 | 30 | 4. Browse our [Books & Tutorials](https://github.com/XxAlonexX/Game-Dev-Notes/tree/main/Books) to learn about game mechanics, design patterns, and more. 31 | 32 | 5. Get hands-on experience with our, which cover everything from basic game loops to advanced rendering techniques. 33 | 34 | ## Contributing 35 | I welcome contributions from the game development community! If you have knowledge, code, or resources to share, please feel free to open a pull request. Let's learn and grow together! 36 | 37 | ## Connect with Me 38 | 39 | Have questions, ideas, or want to connect with fellow game developers? Join our community on [Discord](https://discord.gg/984812117288976424) and follow us on [Twitter](https://twitter.com/FanWidoutPlay). 40 | 41 | Happy coding and game development! 🚀🎮 -------------------------------------------------------------------------------- /DSA/Notes/04_Advanced_Topics.md: -------------------------------------------------------------------------------- 1 | # Advance Graph Algorithms 2 | Advanced graph algorithms are specialized algorithms designed to solve complex problems on graphs. These algorithms often involve traversing or analyzing the structure of graphs in more intricate ways than basic graph algorithms like BFS and DFS. Here are examples of some advanced graph algorithms implemented in C++. 3 | ### Kruskal's Algorithm (Minimum Spanning Tree): 4 | Kruskal's algorithm finds the minimum spanning tree (MST) of a weighted graph, which is a subgraph that includes all vertices with the minimum possible total edge weight. 5 | ```cpp 6 | #include 7 | #include 8 | #include 9 | 10 | struct Edge { 11 | int src, dest, weight; 12 | }; 13 | 14 | class Graph { 15 | public: 16 | int V, E; 17 | std::vector edges; 18 | 19 | Graph(int vertices, int edgesCount); 20 | void addEdge(int src, int dest, int weight); 21 | void kruskalMST(); 22 | }; 23 | 24 | Graph::Graph(int vertices, int edgesCount) : V(vertices), E(edgesCount) {} 25 | 26 | void Graph::addEdge(int src, int dest, int weight) { 27 | edges.push_back({src, dest, weight}); 28 | } 29 | 30 | bool compareEdges(const Edge& a, const Edge& b) { 31 | return a.weight < b.weight; 32 | } 33 | 34 | void Graph::kruskalMST() { 35 | std::vector result; 36 | std::sort(edges.begin(), edges.end(), compareEdges); 37 | 38 | std::vector parent(V); 39 | 40 | for (int i = 0; i < V; ++i) { 41 | parent[i] = i; 42 | } 43 | 44 | int edgeCount = 0, i = 0; 45 | 46 | while (edgeCount < V - 1 && i < E) { 47 | Edge nextEdge = edges[i++]; 48 | 49 | int x = parent[nextEdge.src]; 50 | int y = parent[nextEdge.dest]; 51 | 52 | if (x != y) { 53 | result.push_back(nextEdge); 54 | ++edgeCount; 55 | 56 | for (int j = 0; j < V; ++j) { 57 | if (parent[j] == y) { 58 | parent[j] = x; 59 | } 60 | } 61 | } 62 | } 63 | 64 | std::cout << "Minimum Spanning Tree:\n"; 65 | for (const Edge& edge : result) { 66 | std::cout << edge.src << " - " << edge.dest << " : " << edge.weight << "\n"; 67 | } 68 | } 69 | 70 | int main() { 71 | int V = 4; 72 | int E = 5; 73 | Graph graph(V, E); 74 | 75 | graph.addEdge(0, 1, 10); 76 | graph.addEdge(0, 2, 6); 77 | graph.addEdge(0, 3, 5); 78 | graph.addEdge(1, 3, 15); 79 | graph.addEdge(2, 3, 4); 80 | 81 | graph.kruskalMST(); 82 | 83 | return 0; 84 | } 85 | 86 | ``` 87 | ### Bellman-Ford Algorithm (Single-Source Shortest Path with Negative Weights) 88 | Bellman-Ford is used to find the shortest paths from a single source vertex to all other vertices, even when there are negative weight edges. 89 | ```cpp 90 | #include 91 | #include 92 | 93 | struct Edge { 94 | int src, dest, weight; 95 | }; 96 | 97 | class Graph { 98 | public: 99 | int V, E; 100 | std::vector edges; 101 | 102 | Graph(int vertices, int edgesCount); 103 | void addEdge(int src, int dest, int weight); 104 | void bellmanFord(int source); 105 | }; 106 | 107 | Graph::Graph(int vertices, int edgesCount) : V(vertices), E(edgesCount) {} 108 | 109 | void Graph::addEdge(int src, int dest, int weight) { 110 | edges.push_back({src, dest, weight}); 111 | } 112 | 113 | void Graph::bellmanFord(int source) { 114 | std::vector dist(V, INT_MAX); 115 | dist[source] = 0; 116 | 117 | for (int i = 0; i < V - 1; ++i) { 118 | for (const Edge& edge : edges) { 119 | int u = edge.src; 120 | int v = edge.dest; 121 | int w = edge.weight; 122 | 123 | if (dist[u] != INT_MAX && dist[u] + w < dist[v]) { 124 | dist[v] = dist[u] + w; 125 | } 126 | } 127 | } 128 | 129 | for (const Edge& edge : edges) { 130 | int u = edge.src; 131 | int v = edge.dest; 132 | int w = edge.weight; 133 | 134 | if (dist[u] != INT_MAX && dist[u] + w < dist[v]) { 135 | std::cout << "Negative cycle detected!\n"; 136 | return; 137 | } 138 | } 139 | 140 | std::cout << "Shortest distances from source vertex:\n"; 141 | for (int i = 0; i < V; ++i) { 142 | std::cout << "Vertex " << i << ": " << dist[i] << "\n"; 143 | } 144 | } 145 | 146 | int main() { 147 | int V = 5; 148 | int E = 8; 149 | Graph graph(V, E); 150 | 151 | graph.addEdge(0, 1, -1); 152 | graph.addEdge(0, 2, 4); 153 | graph.addEdge(1, 2, 3); 154 | graph.addEdge(1, 3, 2); 155 | graph.addEdge(1, 4, 2); 156 | graph.addEdge(3, 2, 5); 157 | graph.addEdge(3, 1, 1); 158 | graph.addEdge(4, 3, -3); 159 | 160 | graph.bellmanFord(0); 161 | 162 | return 0; 163 | } 164 | 165 | ``` 166 | ### Floyd-Warshall Algorithm (All Pairs Shortest Path) 167 | Floyd-Warshall finds the shortest paths between all pairs of vertices in a weighted graph. 168 | ```cpp 169 | #include 170 | #include 171 | 172 | const int INF = INT_MAX; 173 | 174 | class Graph { 175 | public: 176 | int V; 177 | std::vector> adjMatrix; 178 | 179 | Graph(int vertices); 180 | void addEdge(int src, int dest, int weight); 181 | void floydWarshall(); 182 | }; 183 | 184 | Graph::Graph(int vertices) : V(vertices) { 185 | adjMatrix.assign(V, std::vector(V, INF)); 186 | 187 | for (int i = 0; i < V; ++i) { 188 | adjMatrix[i][i] = 0; 189 | } 190 | } 191 | 192 | void Graph::addEdge(int src, int dest, int weight) { 193 | adjMatrix[src][dest] = weight; 194 | } 195 | 196 | void Graph::floydWarshall() { 197 | std::vector> dist = adjMatrix; 198 | 199 | for (int k = 0; k < V; ++k) { 200 | for (int i = 0; i < V; ++i) { 201 | for (int j = 0; j < V; ++j) { 202 | if (dist[i][k] != INF && dist[k][j] != INF && 203 | dist[i][k] + dist[k][j] < dist[i][j]) { 204 | dist[i][j] = dist[i][k] + dist[k][j]; 205 | } 206 | } 207 | } 208 | } 209 | 210 | std::cout << "Shortest path distances between all pairs of vertices:\n"; 211 | for (int i = 0; i < V; ++i) { 212 | for (int j = 0; j < V; ++j) { 213 | if (dist[i][j] == INF) { 214 | std::cout << "INF "; 215 | } else { 216 | std::cout << dist[i][j] << " "; 217 | } 218 | } 219 | std::cout << "\n"; 220 | } 221 | } 222 | 223 | int main() { 224 | int V = 4; 225 | Graph graph(V); 226 | 227 | graph.addEdge(0, 1, 3); 228 | graph.addEdge(0, 2, 6); 229 | graph.addEdge(1, 2, 2); 230 | graph.addEdge(1, 3, 1); 231 | graph.addEdge(2, 1, 1); 232 | graph.addEdge(2, 3, 4); 233 | graph.addEdge(3, 0, 2); 234 | graph.addEdge(3, 2, 1); 235 | 236 | graph.floydWarshall(); 237 | 238 | return 0; 239 | } 240 | ``` 241 | # Advanced Data Structure 242 | Advanced data structures are specialized data structures designed to efficiently solve specific types of problems or provide advanced functionality beyond what basic data structures like arrays and linked lists offer. Here are some examples of advanced data structures implemented in C++ 243 | ### B-Trees 244 | B-Trees are self-balancing tree structures that maintain sorted data and are commonly used in databases and file systems to store and manage large amounts of data efficiently. 245 | ```cpp 246 | #include 247 | #include 248 | 249 | int main() { 250 | std::set btree; 251 | btree.insert(10); 252 | btree.insert(20); 253 | btree.insert(5); 254 | 255 | std::cout << "B-Tree elements: "; 256 | for (int elem : btree) { 257 | std::cout << elem << " "; 258 | } 259 | 260 | return 0; 261 | } 262 | 263 | ``` 264 | ### Red-Black Trees 265 | Red-Black Trees are self-balancing binary search trees that guarantee logarithmic time complexity for insertion, deletion, and search operations. 266 | ```cpp 267 | #include 268 | #include 269 | 270 | int main() { 271 | std::map redBlackTree; 272 | redBlackTree[1] = "One"; 273 | redBlackTree[3] = "Three"; 274 | redBlackTree[2] = "Two"; 275 | 276 | std::cout << "Red-Black Tree elements: "; 277 | for (const auto& pair : redBlackTree) { 278 | std::cout << "(" << pair.first << ", " << pair.second << ") "; 279 | } 280 | 281 | return 0; 282 | } 283 | ``` 284 | ### Segment Trees 285 | Segment Trees are used for various range query operations, such as finding the sum, minimum, or maximum of elements within a specified range in an array. 286 | ```cpp 287 | #include 288 | #include 289 | 290 | class SegmentTree { 291 | public: 292 | SegmentTree(const std::vector& arr); 293 | int getSum(int queryLeft, int queryRight); 294 | 295 | private: 296 | int buildTree(int node, int start, int end); 297 | int getSumUtil(int node, int start, int end, int queryLeft, int queryRight); 298 | 299 | std::vector tree; 300 | std::vector data; 301 | }; 302 | 303 | int main() { 304 | std::vector arr = {1, 3, 5, 7, 9, 11}; 305 | SegmentTree segmentTree(arr); 306 | 307 | int sum = segmentTree.getSum(1, 3); 308 | std::cout << "Sum of elements in range [1, 3]: " << sum << std::endl; 309 | 310 | return 0; 311 | } 312 | ``` 313 | # String Algorithms 314 | String algorithms are essential in computer science and are used to manipulate, search, and analyze strings efficiently. Here are some commonly used string algorithms implemented in C++ 315 | ### **String Concatenation** 316 | Concatenating two strings is a basic operation in string manipulation. 317 | ```cpp 318 | #include 319 | #include 320 | 321 | int main() { 322 | std::string str1 = "Hello, "; 323 | std::string str2 = "world!"; 324 | std::string result = str1 + str2; 325 | 326 | std::cout << "Concatenated string: " << result << std::endl; 327 | 328 | return 0; 329 | } 330 | ``` 331 | ### String Length 332 | Find the length of the string. 333 | ```cpp 334 | #include 335 | #include 336 | 337 | int main() { 338 | std::string str = "Hello, world!"; 339 | int length = str.length(); 340 | 341 | std::cout << "String length: " << length << std::endl; 342 | 343 | return 0; 344 | } 345 | ``` 346 | ### Substring Search 347 | Searching for a substring within a string. 348 | ```cpp 349 | #include 350 | #include 351 | 352 | int main() { 353 | std::string text = "The quick brown fox jumps over the lazy dog."; 354 | std::string pattern = "fox"; 355 | 356 | if (text.find(pattern) != std::string::npos) { 357 | std::cout << "Substring found!" << std::endl; 358 | } else { 359 | std::cout << "Substring not found." << std::endl; 360 | } 361 | 362 | return 0; 363 | } 364 | 365 | ``` 366 | ### String Reversal 367 | Reversing a String. 368 | ```cpp 369 | #include 370 | #include 371 | #include 372 | 373 | int main() { 374 | std::string str = "Hello, world!"; 375 | std::reverse(str.begin(), str.end()); 376 | 377 | std::cout << "Reversed string: " << str << std::endl; 378 | 379 | return 0; 380 | } 381 | ``` 382 | ### String Tokenization 383 | Splitting a string into tokens based on a delimiter. 384 | ```cpp 385 | #include 386 | #include 387 | #include 388 | #include 389 | 390 | int main() { 391 | std::string input = "apple,banana,cherry,date"; 392 | char delimiter = ','; 393 | 394 | std::vector tokens; 395 | std::istringstream tokenStream(input); 396 | std::string token; 397 | 398 | while (std::getline(tokenStream, token, delimiter)) { 399 | tokens.push_back(token); 400 | } 401 | 402 | std::cout << "Tokens:"; 403 | for (const std::string& t : tokens) { 404 | std::cout << " " << t; 405 | } 406 | std::cout << std::endl; 407 | 408 | return 0; 409 | } 410 | ``` 411 | ### String Comparison 412 | Compare two strings. 413 | ```cpp 414 | #include 415 | #include 416 | 417 | int main() { 418 | std::string str1 = "apple"; 419 | std::string str2 = "banana"; 420 | 421 | if (str1 == str2) { 422 | std::cout << "Strings are equal." << std::endl; 423 | } else { 424 | std::cout << "Strings are not equal." << std::endl; 425 | } 426 | 427 | return 0; 428 | } 429 | ``` 430 | ### String Matching Algorithms 431 | Advanced string matching algorithms like the Knuth-Morris-Pratt (KMP) algorithm or the Boyer-Moore algorithm are used to find occurrences of a pattern within a text efficiently. 432 | 433 | >Example: Knuth-Morris-Pratt (KMP) Algorithm 434 | ```cpp 435 | #include 436 | #include 437 | 438 | void computeLPS(const std::string& pattern, std::vector& lps) { 439 | int length = 0; 440 | int i = 1; 441 | lps[0] = 0; 442 | 443 | while (i < pattern.length()) { 444 | if (pattern[i] == pattern[length]) { 445 | ++length; 446 | lps[i] = length; 447 | ++i; 448 | } else { 449 | if (length != 0) { 450 | length = lps[length - 1]; 451 | } else { 452 | lps[i] = 0; 453 | ++i; 454 | } 455 | } 456 | } 457 | } 458 | 459 | void KMPSearch(const std::string& text, const std::string& pattern) { 460 | std::vector lps(pattern.length()); 461 | computeLPS(pattern, lps); 462 | 463 | int i = 0, j = 0; 464 | while (i < text.length()) { 465 | if (pattern[j] == text[i]) { 466 | ++i; 467 | ++j; 468 | } 469 | if (j == pattern.length()) { 470 | std::cout << "Pattern found at index " << i - j << std::endl; 471 | j = lps[j - 1]; 472 | } else if (i < text.length() && pattern[j] != text[i]) { 473 | if (j != 0) { 474 | j = lps[j - 1]; 475 | } else { 476 | ++i; 477 | } 478 | } 479 | } 480 | } 481 | 482 | int main() { 483 | std::string text = "ABABDABACDABABCABAB"; 484 | std::string pattern = "ABABCABAB"; 485 | 486 | KMPSearch(text, pattern); 487 | 488 | return 0; 489 | } 490 | 491 | ``` -------------------------------------------------------------------------------- /DSA/C++ Data Structures and Algorithms Cheat Sheet.md: -------------------------------------------------------------------------------- 1 | ## Table of Contents 2 | 3 | 4 | 5 | - [C++ Data Structures and Algorithms Cheat Sheet](#c-data-structures-and-algorithms-cheat-sheet) 6 | - [Table of Contents](#table-of-contents) 7 | - [1.0 Data Structures](#10-data-structures) 8 | - [1.1 Overview](#11-overview) 9 | - [1.2 Vector `std::vector`](#12-vector-stdvector) 10 | - [1.3 Deque `std::deque`](#13-deque-stddeque) 11 | - [1.4 List `std::list` and `std::forward_list`](#14-list-stdlist-and-stdforward_list) 12 | - [1.5 Map `std::map` and `std::unordered_map`](#15-map-stdmap-and-stdunordered_map) 13 | - [1.6 Set `std::set`](#16-set-stdset) 14 | - [1.7 Stack `std::stack`](#17-stack-stdstack) 15 | - [1.8 Queue `std::queue`](#18-queue-stdqueue) 16 | - [1.9 Priority Queue `std::priority_queue`](#19-priority-queue-stdpriority_queue) 17 | - [1.10 Heap `std::priority_queue`](#110-heap-stdpriority_queue) 18 | - [2.0 Trees](#20-trees) 19 | - [2.1 Binary Tree](#21-binary-tree) 20 | - [2.2 Balanced Trees](#22-balanced-trees) 21 | - [2.3 Binary Search](#23-binary-search) 22 | - [2.4 Depth-First Search](#24-depth-first-search) 23 | - [2.5 Breadth-First Search](#25-breadth-first-search) 24 | - [3.0 NP Complete Problems](#30-np-complete-problems) 25 | - [3.1 NP Complete](#31-np-complete) 26 | - [3.2 Traveling Salesman Problem](#32-traveling-salesman-problem) 27 | - [3.3 Knapsack Problem](#33-knapsack-problem) 28 | - [4.0 Algorithms](#40-algorithms) 29 | - [4.1 Insertion Sort](#41-insertion-sort) 30 | - [4.2 Selection Sort](#42-selection-sort) 31 | - [4.3 Bubble Sort](#43-bubble-sort) 32 | - [4.4 Merge Sort](#44-merge-sort) 33 | - [4.5 Quicksort](#45-quicksort) 34 | 35 | 36 | 37 | 38 | ## 1.0 Data Structures 39 | ### 1.1 Overview 40 | 41 | ![Legend](General/Legend.png) 42 | 43 | ![DataStructures](General/Data%20Structures.png "Data Structures") 44 | 45 | ![ComplexityChart](General/Complexity%20Chart.png "Complexity Chart") 46 | 47 | ![DataStructureSelection](General/Data%20Structures%20Selection.png "Data Structures Selection") 48 | ------------------------------------------------------- 49 | ### 1.2 Vector `std::vector` 50 | **Use for** 51 | * Simple storage 52 | * Adding but not deleting 53 | * Serialization 54 | * Quick lookups by index 55 | * Easy conversion to C-style arrays 56 | * Efficient traversal (contiguous CPU caching) 57 | 58 | **Do not use for** 59 | * Insertion/deletion in the middle of the list 60 | * Dynamically changing storage 61 | * Non-integer indexing 62 | 63 | **Time Complexity** 64 | 65 | | Operation | Time Complexity | 66 | |--------------|-----------------| 67 | | Insert Head | `O(n)` | 68 | | Insert Index | `O(n)` | 69 | | Insert Tail | `O(1)` | 70 | | Remove Head | `O(n)` | 71 | | Remove Index | `O(n)` | 72 | | Remove Tail | `O(1)` | 73 | | Find Index | `O(1)` | 74 | | Find Object | `O(n)` | 75 | 76 | **Example Code** 77 | ```c++ 78 | std::vector v; 79 | 80 | //--------------------------------- 81 | // General Operations 82 | //--------------------------------- 83 | 84 | // Size 85 | unsigned int size = v.size(); 86 | 87 | // Insert head, index, tail 88 | v.insert(v.begin(), value); // head 89 | v.insert(v.begin() + index, value); // index 90 | v.push_back(value); // tail 91 | 92 | // Access head, index, tail 93 | int head = v.front(); // head 94 | head = v[0]; // or using array style indexing 95 | 96 | int value = v.at(index); // index 97 | value = v[index]; // or using array style indexing 98 | 99 | int tail = v.back(); // tail 100 | tail = v[v.size() - 1]; // or using array style indexing 101 | 102 | // Iterate 103 | for(std::vector::iterator it = v.begin(); it != v.end(); it++) { 104 | std::cout << *it << std::endl; 105 | } 106 | 107 | // Remove head, index, tail 108 | v.erase(v.begin()); // head 109 | v.erase(v.begin() + index); // index 110 | v.pop_back(); // tail 111 | 112 | // Clear 113 | v.clear(); 114 | ``` 115 | ------------------------------------------------------- 116 | ### 1.3 Deque `std::deque` 117 | **Use for** 118 | * Similar purpose of `std::vector` 119 | * Basically `std::vector` with efficient `push_front` and `pop_front` 120 | 121 | **Do not use for** 122 | * C-style contiguous storage (not guaranteed) 123 | 124 | **Notes** 125 | * Pronounced 'deck' 126 | * Stands for **D**ouble **E**nded **Que**ue 127 | 128 | **Time Complexity** 129 | 130 | | Operation | Time Complexity | 131 | |--------------|-----------------| 132 | | Insert Head | `O(1)` | 133 | | Insert Index | `O(n) or O(1)`| 134 | | Insert Tail | `O(1)` | 135 | | Remove Head | `O(1)` | 136 | | Remove Index | `O(n)` | 137 | | Remove Tail | `O(1)` | 138 | | Find Index | `O(1)` | 139 | | Find Object | `O(n)` | 140 | 141 | **Example Code** 142 | ```c++ 143 | std::deque d; 144 | 145 | //--------------------------------- 146 | // General Operations 147 | //--------------------------------- 148 | 149 | // Insert head, index, tail 150 | d.push_front(value); // head 151 | d.insert(d.begin() + index, value); // index 152 | d.push_back(value); // tail 153 | 154 | // Access head, index, tail 155 | int head = d.front(); // head 156 | int value = d.at(index); // index 157 | int tail = d.back(); // tail 158 | 159 | // Size 160 | unsigned int size = d.size(); 161 | 162 | // Iterate 163 | for(std::deque::iterator it = d.begin(); it != d.end(); it++) { 164 | std::cout << *it << std::endl; 165 | } 166 | 167 | // Remove head, index, tail 168 | d.pop_front(); // head 169 | d.erase(d.begin() + index); // index 170 | d.pop_back(); // tail 171 | 172 | // Clear 173 | d.clear(); 174 | ``` 175 | ------------------------------------------------------- 176 | ### 1.4 List `std::list` and `std::forward_list` 177 | **Use for** 178 | * Insertion into the middle/beginning of the list 179 | * Efficient sorting (pointer swap vs. copying) 180 | 181 | **Do not use for** 182 | * Direct access 183 | 184 | **Time Complexity** 185 | 186 | | Operation | Time Complexity | 187 | |--------------|-----------------| 188 | | Insert Head | `O(1)` | 189 | | Insert Index | `O(n)` | 190 | | Insert Tail | `O(1)` | 191 | | Remove Head | `O(1)` | 192 | | Remove Index | `O(n)` | 193 | | Remove Tail | `O(1)` | 194 | | Find Index | `O(n)` | 195 | | Find Object | `O(n)` | 196 | 197 | **Example Code** 198 | ```c++ 199 | std::list l; 200 | 201 | //--------------------------------- 202 | // General Operations 203 | //--------------------------------- 204 | 205 | // Insert head, index, tail 206 | l.push_front(value); // head 207 | l.insert(l.begin() + index, value); // index 208 | l.push_back(value); // tail 209 | 210 | // Access head, index, tail 211 | int head = l.front(); // head 212 | int value = std::next(l.begin(), index); // index 213 | int tail = l.back(); // tail 214 | 215 | // Size 216 | unsigned int size = l.size(); 217 | 218 | // Iterate 219 | for(std::list::iterator it = l.begin(); it != l.end(); it++) { 220 | std::cout << *it << std::endl; 221 | } 222 | 223 | // Remove head, index, tail 224 | l.pop_front(); // head 225 | l.erase(l.begin() + index); // index 226 | l.pop_back(); // tail 227 | 228 | // Clear 229 | l.clear(); 230 | 231 | //--------------------------------- 232 | // Container-Specific Operations 233 | //--------------------------------- 234 | 235 | // Splice: Transfer elements from list to list 236 | // splice(iterator pos, list &x) 237 | // splice(iterator pos, list &x, iterator i) 238 | // splice(iterator pos, list &x, iterator first, iterator last) 239 | l.splice(l.begin() + index, list2); 240 | 241 | // Remove: Remove an element by value 242 | l.remove(value); 243 | 244 | // Unique: Remove duplicates 245 | l.unique(); 246 | 247 | // Merge: Merge two sorted lists 248 | l.merge(list2); 249 | 250 | // Sort: Sort the list 251 | l.sort(); 252 | 253 | // Reverse: Reverse the list order 254 | l.reverse(); 255 | ``` 256 | ------------------------------------------------------- 257 | ### 1.5 Map `std::map` and `std::unordered_map` 258 | **Use for** 259 | * Key-value pairs 260 | * Constant lookups by key 261 | * Searching if key/value exists 262 | * Removing duplicates 263 | * `std::map` 264 | * Ordered map 265 | * `std::unordered_map` 266 | * Hash table 267 | 268 | **Do not use for** 269 | * Sorting 270 | 271 | **Notes** 272 | * Typically ordered maps (`std::map`) are slower than unordered maps (`std::unordered_map`) 273 | * Maps are typically implemented as *binary search trees* 274 | 275 | **Time Complexity** 276 | 277 | **`std::map`** 278 | 279 | | Operation | Time Complexity | 280 | |---------------------|-----------------| 281 | | Insert | `O(log(n))` | 282 | | Access by Key | `O(log(n))` | 283 | | Remove by Key | `O(log(n))` | 284 | | Find/Remove Value | `O(log(n))` | 285 | 286 | **`std::unordered_map`** 287 | 288 | | Operation | Time Complexity | 289 | |---------------------|-----------------| 290 | | Insert | `O(1)` | 291 | | Access by Key | `O(1)` | 292 | | Remove by Key | `O(1)` | 293 | | Find/Remove Value | -- | 294 | 295 | **Example Code** 296 | ```c++ 297 | std::map m; 298 | 299 | //--------------------------------- 300 | // General Operations 301 | //--------------------------------- 302 | 303 | // Insert 304 | m.insert(std::pair("key", "value")); 305 | 306 | // Access by key 307 | std::string value = m.at("key"); 308 | 309 | // Size 310 | unsigned int size = m.size(); 311 | 312 | // Iterate 313 | for(std::map::iterator it = m.begin(); it != m.end(); it++) { 314 | std::cout << (*it).first << " " << (*it).second << std::endl; 315 | } 316 | 317 | // Remove by key 318 | m.erase("key"); 319 | 320 | // Clear 321 | m.clear(); 322 | 323 | //--------------------------------- 324 | // Container-Specific Operations 325 | //--------------------------------- 326 | 327 | // Find if an element exists by key 328 | bool exists = (m.find("key") != m.end()); 329 | 330 | // Count the number of elements with a certain key 331 | unsigned int count = m.count("key"); 332 | ``` 333 | ------------------------------------------------------- 334 | ### 1.6 Set `std::set` 335 | **Use for** 336 | * Removing duplicates 337 | * Ordered dynamic storage 338 | 339 | **Do not use for** 340 | * Simple storage 341 | * Direct access by index 342 | 343 | **Notes** 344 | * Sets are often implemented with binary search trees 345 | 346 | **Time Complexity** 347 | 348 | | Operation | Time Complexity | 349 | |--------------|-----------------| 350 | | Insert | `O(log(n))` | 351 | | Remove | `O(log(n))` | 352 | | Find | `O(log(n))` | 353 | 354 | **Example Code** 355 | ```c++ 356 | std::set s; 357 | 358 | //--------------------------------- 359 | // General Operations 360 | //--------------------------------- 361 | 362 | // Insert 363 | s.insert(20); 364 | 365 | // Size 366 | unsigned int size = s.size(); 367 | 368 | // Iterate 369 | for(std::set::iterator it = s.begin(); it != s.end(); it++) { 370 | std::cout << *it << std::endl; 371 | } 372 | 373 | // Remove 374 | s.erase(20); 375 | 376 | // Clear 377 | s.clear(); 378 | 379 | //--------------------------------- 380 | // Container-Specific Operations 381 | //--------------------------------- 382 | 383 | // Find if an element exists 384 | bool exists = (s.find(20) != s.end()); 385 | 386 | // Count the number of elements with a certain value 387 | unsigned int count = s.count(20); 388 | ``` 389 | ------------------------------------------------------- 390 | ### 1.7 Stack `std::stack` 391 | **Use for** 392 | * First-In Last-Out operations 393 | * Reversal of elements 394 | 395 | **Time Complexity** 396 | 397 | | Operation | Time Complexity | 398 | |--------------|-----------------| 399 | | Push | `O(1)` | 400 | | Pop | `O(1)` | 401 | | Top | `O(1)` | 402 | 403 | **Example Code** 404 | ```c++ 405 | std::stack s; 406 | 407 | //--------------------------------- 408 | // Container-Specific Operations 409 | //--------------------------------- 410 | 411 | // Push 412 | s.push(20); 413 | 414 | // Size 415 | unsigned int size = s.size(); 416 | 417 | // Pop 418 | s.pop(); 419 | 420 | // Top 421 | int top = s.top(); 422 | ``` 423 | ------------------------------------------------------- 424 | ### 1.8 Queue `std::queue` 425 | **Use for** 426 | * First-In First-Out operations 427 | * Ex: Simple online ordering system (first come first served) 428 | * Ex: Semaphore queue handling 429 | * Ex: CPU scheduling (FCFS) 430 | 431 | **Notes** 432 | * Often implemented as a `std::deque` 433 | 434 | **Example Code** 435 | ```c++ 436 | std::queue q; 437 | 438 | //--------------------------------- 439 | // General Operations 440 | //--------------------------------- 441 | 442 | // Insert 443 | q.push(value); 444 | 445 | // Access head, tail 446 | int head = q.front(); // head 447 | int tail = q.back(); // tail 448 | 449 | // Size 450 | unsigned int size = q.size(); 451 | 452 | // Remove 453 | q.pop(); 454 | ``` 455 | ------------------------------------------------------- 456 | ### 1.9 Priority Queue `std::priority_queue` 457 | **Use for** 458 | * First-In First-Out operations where **priority** overrides arrival time 459 | * Ex: CPU scheduling (smallest job first, system/user priority) 460 | * Ex: Medical emergencies (gunshot wound vs. broken arm) 461 | 462 | **Notes** 463 | * Often implemented as a `std::vector` 464 | 465 | **Example Code** 466 | ```c++ 467 | std::priority_queue p; 468 | 469 | //--------------------------------- 470 | // General Operations 471 | //--------------------------------- 472 | 473 | // Insert 474 | p.push(value); 475 | 476 | // Access 477 | int top = p.top(); // 'Top' element 478 | 479 | // Size 480 | unsigned int size = p.size(); 481 | 482 | // Remove 483 | p.pop(); 484 | ``` 485 | ------------------------------------------------------- 486 | ### 1.10 Heap `std::priority_queue` 487 | **Notes** 488 | * A heap is essentially an instance of a priority queue 489 | * A **min** heap is structured with the root node as the smallest and each child subsequently larger than its parent 490 | * A **max** heap is structured with the root node as the largest and each child subsequently smaller than its parent 491 | * A min heap could be used for *Smallest Job First* CPU Scheduling 492 | * A max heap could be used for *Priority* CPU Scheduling 493 | 494 | **Max Heap Example (using a binary tree)** 495 | 496 | ![MaxHeap](General/MaxHeap.png) 497 | ------------------------------------------------------- 498 | ## 2.0 Trees 499 | ### 2.1 Binary Tree 500 | * A binary tree is a tree with at most two (2) child nodes per parent 501 | * Binary trees are commonly used for implementing `O(log(n))` operations for ordered maps, sets, heaps, and binary search trees 502 | * Binary trees are **sorted** in that nodes with values greater than their parents are inserted to the **right**, while nodes with values less than their parents are inserted to the **left** 503 | 504 | **Binary Search Tree** 505 | 506 | ![BinarySearchTree](General/BinarySearchTree.png) 507 | ------------------------------------------------------- 508 | ### 2.2 Balanced Trees 509 | * Balanced trees are a special type of tree which maintains its balance to ensure `O(log(n))` operations 510 | * When trees are not balanced the benefit of `log(n)` operations is lost due to the highly vertical structure 511 | * Examples of balanced trees: 512 | * AVL Trees 513 | * Red-Black Trees 514 | 515 | ------------------------------------------------------- 516 | ### 2.3 Binary Search 517 | **Idea:** 518 | 1. If current element, return 519 | 2. If less than current element, look left 520 | 3. If more than current element, look right 521 | 4. Repeat 522 | 523 | **Data Structures:** 524 | * Tree 525 | * Sorted array 526 | 527 | **Space:** 528 | * `O(1)` 529 | 530 | **Best Case:** 531 | * `O(1)` 532 | 533 | **Worst Case:** 534 | * `O(log n)` 535 | 536 | **Average:** 537 | * `O(log n)` 538 | 539 | **Visualization:** 540 | 541 | ![BinarySearch](Searching/Animations/Binary%20Search.gif "Binary Search") 542 | ------------------------------------------------------- 543 | ### 2.4 Depth-First Search 544 | **Idea:** 545 | 1. Start at root node 546 | 2. Recursively search all adjacent nodes and mark them as searched 547 | 3. Repeat 548 | 549 | **Data Structures:** 550 | * Tree 551 | * Graph 552 | 553 | **Space:** 554 | * `O(V)`, `V = number of verticies` 555 | 556 | **Performance:** 557 | * `O(E)`, `E = number of edges` 558 | 559 | **Visualization:** 560 | 561 | ![DepthFirstSearch](Searching/Animations/Depth-First%20Search.gif "Depth-First Search") 562 | ------------------------------------------------------- 563 | ### 2.5 Breadth-First Search 564 | **Idea:** 565 | 1. Start at root node 566 | 2. Search neighboring nodes first before moving on to next level 567 | 568 | **Data Structures:** 569 | * Tree 570 | * Graph 571 | 572 | **Space:** 573 | * `O(V)`, `V = number of verticies` 574 | 575 | **Performance:** 576 | * `O(E)`, `E = number of edges` 577 | 578 | **Visualization:** 579 | 580 | ![DepthFirstSearch](Searching/Animations/Breadth-First%20Search.gif "Breadth-First Search") 581 | ------------------------------------------------------- 582 | ## 3.0 NP Complete Problems 583 | ### 3.1 NP Complete 584 | * **NP Complete** means that a problem is unable to be solved in **polynomial time** 585 | * NP Complete problems can be *verified* in polynomial time, but not *solved* 586 | 587 | ------------------------------------------------------- 588 | ### 3.2 Traveling Salesman Problem 589 | 590 | ------------------------------------------------------- 591 | ### 3.3 Knapsack Problem 592 | 593 | [Implementation](NP-complete/knapsack/) 594 | 595 | ------------------------------------------------------- 596 | 597 | ## 4.0 Algorithms 598 | ### 4.1 Insertion Sort 599 | #### Idea 600 | 1. Iterate over all elements 601 | 2. For each element: 602 | * Check if element is larger than largest value in sorted array 603 | 3. If larger: Move on 604 | 4. If smaller: Move item to correct position in sorted array 605 | 606 | #### Details 607 | * **Data structure:** Array 608 | * **Space:** `O(1)` 609 | * **Best Case:** Already sorted, `O(n)` 610 | * **Worst Case:** Reverse sorted, `O(n^2)` 611 | * **Average:** `O(n^2)` 612 | 613 | #### Advantages 614 | * Easy to code 615 | * Intuitive 616 | * Better than selection sort and bubble sort for small data sets 617 | * Can sort in-place 618 | 619 | #### Disadvantages 620 | * Very inefficient for large datasets 621 | 622 | #### Visualization 623 | 624 | ![InsertionSort](Sorting/Animations/Insertion%20Sort.gif "Insertion Sort") 625 | ------------------------------------------------------- 626 | ### 4.2 Selection Sort 627 | #### Idea 628 | 1. Iterate over all elements 629 | 2. For each element: 630 | * If smallest element of unsorted sublist, swap with left-most unsorted element 631 | 632 | #### Details 633 | * **Data structure:** Array 634 | * **Space:** `O(1)` 635 | * **Best Case:** Already sorted, `O(n^2)` 636 | * **Worst Case:** Reverse sorted, `O(n^2)` 637 | * **Average:** `O(n^2)` 638 | 639 | #### Advantages 640 | * Simple 641 | * Can sort in-place 642 | * Low memory usage for small datasets 643 | 644 | #### Disadvantages 645 | * Very inefficient for large datasets 646 | 647 | #### Visualization 648 | 649 | ![SelectionSort](Sorting/Animations/Selection%20Sort.gif "Selection Sort") 650 | 651 | ![SelectionSort](Sorting/Animations/Selection%20Sort%202.gif "Selection Sort 2") 652 | ------------------------------------------------------- 653 | ### 4.3 Bubble Sort 654 | #### Idea 655 | 1. Iterate over all elements 656 | 2. For each element: 657 | * Swap with next element if out of order 658 | 3. Repeat until no swaps needed 659 | 660 | #### Details 661 | * **Data structure:** Array 662 | * **Space:** `O(1)` 663 | * **Best Case:** Already sorted `O(n)` 664 | * **Worst Case:** Reverse sorted, `O(n^2)` 665 | * **Average:** `O(n^2)` 666 | 667 | #### Advantages 668 | * Easy to detect if list is sorted 669 | 670 | #### Disadvantages 671 | * Very inefficient for large datasets 672 | * Much worse than even insertion sort 673 | 674 | #### Visualization 675 | 676 | ![BubbleSort](Sorting/Animations/Bubble%20Sort.gif "Bubble Sort") 677 | ------------------------------------------------------- 678 | ### 4.4 Merge Sort 679 | #### Idea 680 | 1. Divide list into smallest unit (1 element) 681 | 2. Compare each element with the adjacent list 682 | 3. Merge the two adjacent lists 683 | 4. Repeat 684 | 685 | #### Details 686 | * **Data structure:** Array 687 | * **Space:** `O(n) auxiliary` 688 | * **Best Case:** `O(nlog(n))` 689 | * **Worst Case:** Reverse sorted, `O(nlog(n))` 690 | * **Average:** `O(nlog(n))` 691 | 692 | #### Advantages 693 | * High efficiency on large datasets 694 | * Nearly always O(nlog(n)) 695 | * Can be parallelized 696 | * Better space complexity than standard Quicksort 697 | 698 | #### Disadvantages 699 | * Still requires O(n) extra space 700 | * Slightly worse than Quicksort in some instances 701 | 702 | #### Visualization 703 | 704 | ![MergeSort](Sorting/Animations/Merge%20Sort.gif "Merge Sort") 705 | 706 | ![MergeSort](Sorting/Animations/Merge%20Sort%202.gif "Merge Sort 2") 707 | ------------------------------------------------------- 708 | ### 4.5 Quicksort 709 | #### Idea 710 | 1. Choose a **pivot** from the array 711 | 2. Partition: Reorder the array so that all elements with values *less* than the pivot come before the pivot, and all values *greater* than the pivot come after 712 | 3. Recursively apply the above steps to the sub-arrays 713 | 714 | #### Details 715 | * **Data structure:** Array 716 | * **Space:** `O(n)` 717 | * **Best Case:** `O(nlog(n))` 718 | * **Worst Case:** All elements equal, `O(n^2)` 719 | * **Average:** `O(nlog(n))` 720 | 721 | #### Advantages 722 | * Can be modified to use O(log(n)) space 723 | * Very quick and efficient with large datasets 724 | * Can be parallelized 725 | * Divide and conquer algorithm 726 | 727 | #### Disadvantages 728 | * Not stable (could swap equal elements) 729 | * Worst case is worse than Merge Sort 730 | 731 | #### Optimizations 732 | * Choice of pivot: 733 | * Choose median of the first, middle, and last elements as pivot 734 | * Counters worst-case complexity for already-sorted and reverse-sorted 735 | 736 | #### Visualization 737 | 738 | ![QuickSort](Sorting/Animations/Quicksort.gif) --------------------------------------------------------------------------------