Skip to content

Instantly share code, notes, and snippets.

@sameer-j
sameer-j / UCF.cpp
Last active January 2, 2023 22:05
Uniform Cost Search Algorithm C++ Implementation
//Algorithm:
// Insert the root into the queue
// While the queue is not empty
// Dequeue the maximum priority element from the queue
// (If priorities are same, alphabetically smaller path is chosen)
// If the path is ending in the goal state, print the path and exit
// Else
// Insert all the children of the dequeued element, with the cumulative costs as priority
//url: https://algorithmicthoughts.wordpress.com/2012/12/15/artificial-intelligence-uniform-cost-searchucs/
#include <iostream>
@sameer-j
sameer-j / BFS.cpp
Created January 26, 2016 10:05
Breadth First Search Algorithm; C++ Implementation
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include<stdlib.h>
using namespace std;
class Graph
{
int V;