Skip to content

Instantly share code, notes, and snippets.

View milon's full-sized avatar
📧
Want a quick response? Tweet @to_milon.

Nuruzzaman Milon milon

📧
Want a quick response? Tweet @to_milon.
View GitHub Profile
@milon
milon / SieveOfEratosthenes.cpp
Created January 19, 2018 01:53
Prime Number: Sieve of Eratosthenes
//Sieve of Eratosthenes
//Author: Milon
#include<cstdio>
#include<cmath>
using namespace std;
#define max 19000000
bool prime[max+1];
@milon
milon / Prime04.cpp
Created January 19, 2018 01:52
Prime Number
//Prime number check
//Author: Milon
bool isPrime(int num){
if(num==1)
return false;
if(num==2)
return true;
if(num%2==0)
return false;
@milon
milon / Prime03.cpp
Created January 19, 2018 01:52
Prime Number
//Prime number check
//Author: Milon
bool isPrime(int num){
if(num<2)
return false;
if(num==2)
return true;
if(num%2==0)
return false;
@milon
milon / Prime02.cpp
Created January 19, 2018 01:51
Prime Number
//Prime number check
//Author: Milon
bool isPrime(int num){
if(num<2)
return false;
if(num==2)
return true;
if(num%2==0)
return false;
@milon
milon / Prime01.cpp
Created January 19, 2018 01:50
Prime Number
//Prime number check
//Author: Milon
#include<iostream>
using namespace std;
bool isPrime(int num){
if(num<2)
return false;
for(int i=2;i<num;i++)
@milon
milon / WeightedGraph.cpp
Created January 19, 2018 01:47
Data Structure: Weighted Graph
//Weighted graph
//Author: Milon
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
int n;
cout<<"Enter the number of nodes: ";
@milon
milon / AdjacencyList.cpp
Created January 19, 2018 01:46
Data Structure: Adjacency List
//Adjacency list
//Author: Milon
#include<iostream>
#include<cstdlib>
using namespace std;
struct list{
int val;
struct list *next;
@milon
milon / DirectedGraph.cpp
Created January 19, 2018 01:44
Data Structure: Directed Graph
//Directed graph
//Author: Milon
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
int n;
cout<<"Enter the number of nodes: ";
@milon
milon / TwoWayLinkedList.java
Created January 19, 2018 01:41
Data Structure: Two Way Linked List
//Two Way Linked List
//Author: Milon
import java.util.NoSuchElementException;
//Node class
class Node{
//Instance variable
private Object data;
private Node nextNode;
@milon
milon / UndirectedGraph.cpp
Last active January 19, 2018 01:39
Data Structure: Undirected Graph
//Directed graph
//Author: Milon
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
int n;
cout<<"Enter the number of nodes: ";