Skip to content

Instantly share code, notes, and snippets.

View hold7door's full-sized avatar
🎯
Focusing

Arpit Pathak hold7door

🎯
Focusing
View GitHub Profile
@hold7door
hold7door / Breadth_First_Search.py
Created July 8, 2018 12:16
Print Level of each vertex from source
#Breadth-First-Search
#Unweighted Directed/Undirected graphs
class Node:
def __init__(self , val):
self.val = val
self.next = None
class LinkedList:
def __init__(self , head = None):
self.head = head
//Uses a Priority Queue
//Extract-min operation on min-heap data structure - theta(log v)
//Negative Weights not allowed
#include<stdio.h>
#include<conio.h>
#define MAX 100
int G[MAX][MAX],pred[MAX],distance[MAX]; //Adjacency matrix , Predecessor of the node , distance from source distance[source]=0