Skip to content

Instantly share code, notes, and snippets.

View rajabishek's full-sized avatar

Raj Abishek rajabishek

View GitHub Profile
@rajabishek
rajabishek / depthFirstTraversal.cpp
Last active August 29, 2015 14:07
Graph - Depth First Traversal
#include<iostream>
#include<stack>
using namespace std;
class Graph{
int nodes; //No of nodes in the graph
int **A; //A is the adjacency matrix => the graph datastructure
public:
Graph(int nodes){
this->nodes = nodes;
@rajabishek
rajabishek / breadthFirstTraversal.cpp
Last active August 29, 2015 14:07
Graph - Breadth First Traversal
#include<iostream>
#include<queue>
#include<stack>
using namespace std;
class Graph{
int nodes; //No of nodes in the graph
int **A; //A is the adjacency matrix => the graph datastructure
public:
Graph(int nodes){
@rajabishek
rajabishek / primsAlgorithm.cpp
Last active September 1, 2015 05:35
Prim's Algorithm - Minimum Spanning Tree
#include<iostream>
#include<stack>
using namespace std;
class Graph{
int nodes; //No of nodes in the graph
int **A; //A is the adjacency matrix => the graph datastructure
public:
Graph(int nodes){
this->nodes = nodes;
@rajabishek
rajabishek / kruskalsAlgorithm.cpp
Last active August 29, 2015 14:08
Kruskal's Algorithm - Minimum Spanning Tree
#include<iostream>
#include<stack>
using namespace std;
class Graph{
int nodes; //No of nodes in the graph
int **A; //A is the adjacency matrix => the graph datastructure
int **B;
public:
Graph(int nodes){
@rajabishek
rajabishek / dijkstras.cpp
Created November 10, 2014 17:18
Dijkstra's algorithm - Shortest Path Algorithm
#include<iostream>
#include<queue>
#include<stack>
using namespace std;
class Graph{
int nodes; //No of nodes in the graph
int **A; //A is the adjacency matrix => the graph datastructure
public:
Graph(int nodes){
@rajabishek
rajabishek / systeminfo.cpp
Last active August 29, 2015 14:14
CPU & Memory information - Linux mint
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
class FileHandling{
public:
void read(string name){
string line;
ifstream myfile(name.c_str());
@rajabishek
rajabishek / ffcs.c
Created January 30, 2015 10:08
FFCS - First come first serve - Process scheduling
#include<stdio.h>
void display();
void getInput();
void calculateWaitTime();
void turnAroundTime();
int n, a[100],b[100];
int main(){
@rajabishek
rajabishek / sjf.c
Created March 19, 2015 14:44
Shortest Job First - Process scheduling
#include<stdio.h>
void main()
{
int bt[20],p[20],wt[20],tat[20],i,j,n,total=0,pos,temp;
float avg_wt,avg_tat;
printf("Enter number of process:");
scanf("%d",&n);
printf("\nEnter Burst Time:\n");
@rajabishek
rajabishek / priority.c
Created March 19, 2015 15:24
Priority - Scheduling Algorithm
#include<stdio.h>
void main()
{
int bt[20],p[20],wt[20],tat[20],pr[20],i,j,n,total=0,pos,temp,avg_wt,avg_tat;
printf("Enter Total Number of Process:");
scanf("%d",&n);
printf("\nEnter Burst Time and Priority\n");
for(i=0;i<n;i++)
@rajabishek
rajabishek / srt.c
Created March 19, 2015 16:14
Shortest remaining time first - Process Scheduling
# include <stdio.h>
int main()
{
int i,p[20],a[20],b[20],br[20],tat[20],gantt[100][2],n1,n2,n3,c,d,e=0,f=0,g,time=0,t1,t2,t3,t4,t5,t6;
float v1=0.0,v2=0.0;
FILE *fp;
fp=fopen("sjf.txt","r");
while (fscanf(fp,"%d%d%d",&n1,&n2,&n3)!=EOF)
{
p[e]=n1;