Tags » BF's

Shortest Distance from All Buildings

You want to build a house on an empty land which reaches all buildings in the shortest amount of distance. You are given a 2D grid of values 0, 1 or 2, where:

Each 0 marks an empty land which you can pass by freely. 353 more words

BFS publications "free"

I’ve been sorting out boxes of BFS publications and found several duplicates. If you want any contact me – all you need to do is pay postage.  125 more words


Day 21 - Song that makes you happy : The greatest rock band ever

Dear internet,

Ok first of all let me apologize, this is the farthest behind I’ve gotten. Let me make my excuses:

Thursday was Riverfest, which I will talk about briefly, so I wanted to wait until after the concert to write this. 555 more words

The BFS and Dark Horizons

A long time ago, before I started The Alchemy Press, I did a lot of editing and production work for the British Fantasy Society — including the magazines… 60 more words


DFS/BFS Graph Search with C#

This is a basic implementation of DFS/BFS graph search with C#. I have not seen many implementations in C# (most educational ones use Java) utilizing the .NET built-in data structures (Stack vs. 36 more words


Number of Islands I, II

Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. 441 more words


Detect cycles in graph

Undirected graph

class Graph
    private int V;   // No. of vertices
    private LinkedList<Integer> adj[]; // Adjacency List Represntation

// Constructor
    Graph(int v) {
        V = v;
        adj = new LinkedList[v];
        for(int i=0; i<v; ++i)
            adj[i] = new LinkedList();

// Function to add an edge into the graph
    void addEdge(int v,int w) {

// A recursive function that uses visited[] and parent to detect
    // cycle in subgraph reachable from vertex v.
335 more words