From 24d57aa4855b178254f36c7378738d1e59997e29 Mon Sep 17 00:00:00 2001 From: Jai Sinha Date: Sun, 2 Oct 2022 14:25:14 +0300 Subject: [PATCH 1/5] Added different types of text-editors that a developer can use in linux at the bottom of the cheatsheet --- linux.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/linux.md b/linux.md index 5835dac..502c838 100644 --- a/linux.md +++ b/linux.md @@ -42,3 +42,10 @@ tar -zcvf foo.txt.tar.gz foo.txt tar -xvf foo.txt.tar.gz ``` +## Text Editor Options for Programmers + +```c +Sublime Text Atom GNU Emacs +Vim Gedit Notepadqq +Nano VsCode Brackets +``` From 7a745fd3ed42b58f2260940c968a8c67207b3798 Mon Sep 17 00:00:00 2001 From: Jai Sinha Date: Mon, 3 Oct 2022 12:46:22 +0300 Subject: [PATCH 2/5] The fundamental defination and the example of closures has been added at the bottom of the cheatsheet --- javascript.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/javascript.md b/javascript.md index 463ff27..b91d5c4 100644 --- a/javascript.md +++ b/javascript.md @@ -349,3 +349,22 @@ throw "Error message"; // throw error text to user |g| Performs a global match and finds all| |i| Performs case-insensitive matching| |m| Performs multiline matching| + +## Closures + +A closure is the combination of a function bundled together (enclosed) with references + to its surrounding state (the lexical environment). In other words, a closure gives you +access to an outer function's scope from an inner function. In JavaScript, closures are +created every time a function is created, at function creation time. + +### Example +```c +function makeFunc() { + const name = 'Mozilla'; + function displayName() { + console.log(name); + } + return displayName; +} +const myFunc = makeFunc(); +myFunc();``` From f1dae91a6e219cedb2afc51226d64cd88b4f3363 Mon Sep 17 00:00:00 2001 From: Jai Sinha Date: Mon, 3 Oct 2022 12:50:20 +0300 Subject: [PATCH 3/5] The basic defination and the example of closures has been added at the bottom of the cheatsheet --- javascript.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/javascript.md b/javascript.md index b91d5c4..c653bc1 100644 --- a/javascript.md +++ b/javascript.md @@ -367,4 +367,4 @@ function makeFunc() { return displayName; } const myFunc = makeFunc(); -myFunc();``` +myFunc(); From 0527169f058d0bdd7cb5de108656025d01404b41 Mon Sep 17 00:00:00 2001 From: Jai Sinha Date: Mon, 3 Oct 2022 13:04:22 +0300 Subject: [PATCH 4/5] The fundamental defination and the example of closures has been added at the bottom of the cheatsheet --- javascript.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/javascript.md b/javascript.md index c653bc1..a5d1b5d 100644 --- a/javascript.md +++ b/javascript.md @@ -358,7 +358,7 @@ access to an outer function's scope from an inner function. In JavaScript, closu created every time a function is created, at function creation time. ### Example -```c +```javascript function makeFunc() { const name = 'Mozilla'; function displayName() { @@ -368,3 +368,5 @@ function makeFunc() { } const myFunc = makeFunc(); myFunc(); +``` + From 1305cdb007348a4e1c0c3461c6c88ddfdd78d082 Mon Sep 17 00:00:00 2001 From: Jai Sinha Date: Mon, 10 Oct 2022 17:09:06 +0300 Subject: [PATCH 5/5] The given information regarding linked list has been added --- cpp.md | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/cpp.md b/cpp.md index b11bfe5..15f6506 100644 --- a/cpp.md +++ b/cpp.md @@ -310,6 +310,65 @@ int main() } ``` +## linked List + +A linked list is an ordered set of data elements, each containing a link to its successor (and sometimes its predecessor) + +The basic operations associated with linked list are-: +Insertion − Adds an element at the beginning of the list. +Deletion − Deletes an element at the beginning of the list. +Display − Displays the complete list. +Search − Searches an element using the given key. +Delete − Deletes an element using the given key. + +```c + +#include +using namespace std; + +class Node { +public: + int data; + Node* next; +}; + +// This function prints contents of linked list +// starting from the given node +void printList(Node* n) +{ + while (n != NULL) { + cout << n->data << " "; + n = n->next; + } +} +int main() +{ + Node* head = NULL; + Node* second = NULL; + Node* third = NULL; + + // allocate 3 nodes in the heap + head = new Node(); + second = new Node(); + third = new Node(); + + head->data = 1; // assign data in first node + head->next = second; // Link first node with second + + second->data = 2; // assign data to second node + second->next = third; + + third->data = 3; // assign data to third node + third->next = NULL; + + // Function call + printList(head); + + return 0; +} + +``` + ## Stacks Stacks are a type of container adaptors with LIFO(Last In First Out) type of working, where a new element is added at one end (top) and an element is removed from that end only.