Skip to content

Instantly share code, notes, and snippets.

View mudassaralichouhan's full-sized avatar
:octocat:
It’s not a bug; it’s an undocumented feature.

Mudassar Ali mudassaralichouhan

:octocat:
It’s not a bug; it’s an undocumented feature.
View GitHub Profile
/**
* Tree:
* - A tree is a hierarchical data structure consisting of nodes connected by edges.
* - It consists of a root node, which is the topmost node, and zero or more child nodes.
* - Each node can have an arbitrary number of children, unlike a binary tree which restricts each node to have at most two children.
* - Trees are used to represent hierarchical relationships such as organizational charts, file systems, and HTML DOM structures.
*/
#include "iostream"
#include "vector"
@mudassaralichouhan
mudassaralichouhan / dequeue.cc
Last active April 26, 2024 10:30
Queue FIFO.
/**
* Dequeue:
* Dequeue is also known as Double Ended Queue.
* As the name suggests double ended,
* it means that an element can be inserted or removed from both ends of the queue, unlike the other queues
* in which it can be done only from one end. Because of this property, it may not obey the First In First Out property.
*
* implement using doubly linked list
*
* Operation Description Time Complexity
@mudassaralichouhan
mudassaralichouhan / stack-using-unique_ptr.cc
Last active April 8, 2024 20:57
Stack principle of Last In First Out (LIFO)
#include "iostream"
#include "memory"
struct StackHolder {
std::string data;
};
class Stack {
private:
int idx = -1;
@mudassaralichouhan
mudassaralichouhan / CDLL.cc
Created March 17, 2024 06:58
Doubly Circular Linked List
/**
* Circular Double Linked List
*
*/
#include "iostream"
using namespace std;
struct Node {
@mudassaralichouhan
mudassaralichouhan / CLL.cc
Created March 10, 2024 20:00
It is a linked list whose nodes are connected in such a way that it forms a circle.
#include "iostream"
using namespace std;
struct Node {
int id;
string name;
Node *next;
Node(unsigned int id, string name, Node *next = nullptr) :
@mudassaralichouhan
mudassaralichouhan / DLL.cc
Created March 3, 2024 19:55
Double Link List [$ g++ main.cc -o main.o && ./main.o]
#include "iostream"
using namespace std;
struct Node {
int id;
string name;
Node *previous;
Node *next;
@mudassaralichouhan
mudassaralichouhan / SLL.cc
Created February 4, 2024 14:10
Single link list
#include "iostream"
using namespace std;
struct Node {
unsigned int no;
string name;
Node *next;
Node(unsigned int data, string name) : no(data), name(name), next(nullptr) {};
@mudassaralichouhan
mudassaralichouhan / isTabActive.html
Created January 6, 2024 19:33
This approach can be used to track if a user has left a webpage by switching to another browser tab or application.
<script>
var isTabActive;
window.onfocus = function () {
console.log("onfocus");
};
window.onblur = function () {
console.log("onblue");
};
https://picsum.photos/400/300
https://dummyimage.com/250/ffffff/000000
https://dummyimage.com/250x300
https://dummyimage.com/300.png/09f/fff
https://dummyimage.com/
# Set default permissions for directories
find /home/me -type d -exec chmod 755 {} \;
# Set default permissions for files
find /home/me -type f -exec chmod 644 {} \;