This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
using namespace std; | |
class Node; | |
class Polynomial; | |
class Term | |
{ | |
int exponent; | |
double coeff; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<cmath> | |
using namespace std; | |
class Vertex | |
{ | |
int x_coordinate, y_coordinate; | |
public : |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
using namespace std; | |
class Meter; | |
class Distance | |
{ | |
int feet,inches; | |
public: | |
Distance(); | |
Distance(int feet); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
using namespace std; | |
class Fraction | |
{ | |
int numerator,denominator; | |
public: | |
Fraction(); | |
Fraction(int num,int deno); | |
Fraction operator+(Fraction a); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
using namespace std; | |
class Complex{ | |
private: | |
int real; | |
int imag; | |
public: | |
// Default constructor | |
Complex(){ |
NewerOlder