Skip to content

Instantly share code, notes, and snippets.

View RahulBRB's full-sized avatar
💻
Learning

R A H U L RahulBRB

💻
Learning
View GitHub Profile
@RahulBRB
RahulBRB / revise.py
Created November 24, 2023 15:14
Important concepts for AI
#BFS
from collections import defaultdict
class Graph:
def __init__(self):
self.graph=defaultdict(list)
def add_edge(self, u , v):
self.graph[u].append(v)
self.graph[v].append(u)
let http = require('http');
let fs = require('fs');
let port = 8772;
let server = http.createServer(function(req, res){
fs.readFile('db.json','utf-8',function(err, data){
if(err) throw err;
res.write(data);
res.end()
})
let http = require('http');
//req > what we send to server (params,queryParams,body)
//res > what server send us
let server = http.createServer((req,res) => {
res.write('Hii From Http Server');
res.end()
})
@RahulBRB
RahulBRB / fs.js
Created October 17, 2023 13:18
File system model for write, append, read, rename, unlink (delete). Commonly used features of the fs module include fs. readFile to read data from a file, fs. writeFile to write data to a file and replace the file if it already exists
let fs = require('fs')
//write file
fs.writeFile('myFile.txt','NodeJs code in code sample', function(){
console.log('File Create')
})
//append file
fs.appendFile('myCode.txt','My code append \n',function(){
console.log('File Appended')
#include <iostream>
#include <cstdlib>
using namespace std;
// Define the default capacity of a stack
#define SIZE 10
// A class to represent a stack
template <class X>
class stack
#include<iostream>
using namespace std;
class Node;
class Polynomial;
class Term
{
int exponent;
double coeff;
#include<iostream>
#include<cmath>
using namespace std;
class Vertex
{
int x_coordinate, y_coordinate;
public :
#include<iostream>
using namespace std;
class Meter;
class Distance
{
int feet,inches;
public:
Distance();
Distance(int feet);
#include<iostream>
using namespace std;
class Fraction
{
int numerator,denominator;
public:
Fraction();
Fraction(int num,int deno);
Fraction operator+(Fraction a);
#include<iostream>
using namespace std;
class Complex{
private:
int real;
int imag;
public:
// Default constructor
Complex(){