Skip to content

Instantly share code, notes, and snippets.

View rajabishek's full-sized avatar

Raj Abishek rajabishek

View GitHub Profile
@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 / 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 / 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 / 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 / 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 / hashtable.cpp
Last active December 11, 2016 07:13
Hash Table with Separate chaining
#include<iostream>
using namespace std;
struct item{
string name;
string drink;
item* next;
};
class HashManager{
@rajabishek
rajabishek / BinarySearchTree.cpp
Last active March 19, 2016 11:03
Binary Search Tree
#include<iostream>
#include<queue>
using namespace std;
class Node {
public:
Node(int data){
this->data = data;
this->left = NULL;
this->right = NULL;
@rajabishek
rajabishek / restoringDivision.cpp
Last active August 29, 2015 14:06
Restoring Division
#include<iostream>
#include<stack>
#include<math.h>
using namespace std;
class LinkedlistManager{
public:
int data;
LinkedlistManager* next;
LinkedlistManager* previous;
@rajabishek
rajabishek / circularQueue.cpp
Last active August 29, 2015 14:06
Circular Queue
#include<iostream>
using namespace std;
#define MAX_SIZE 11
// Creating a class named Queue.
class Queue
{
private:
int A[MAX_SIZE];
int front, rear;
public:
@rajabishek
rajabishek / queue.cpp
Last active October 28, 2021 17:53
Queue
#include<iostream>
using namespace std;
template <class datatype>
class QueueInterface{
public:
virtual void enqueue(datatype data) = 0;
virtual void dequeue() = 0;
virtual bool isEmpty() = 0;
virtual bool isFull(){