Tags » BF's

Breadth First Search and Depth First Search

Breadth First Search (BFS) and Depth First Search (DFS) are searching algorithm for trees or graphs. Both algorithms have identical structure, it goes as below: 983 more words

Java

UVa 10653: Bombs! NO they are Mines!!

Problem Type: BFS, Graph
Problem Summary: Find the shortest path from source to destination in 2D grid containing some bombs (invalid positions).
Algorithm: Given that the position moving to is valid, there are four possible robotic moves (UP, LEFT, RIGHT, DOWN) for each position on grid. 296 more words

UVa

Clone Graph

Problem:

Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors.

OJ’s undirected graph serialization:Nodes are labeled uniquely. 173 more words

Technical And Interview And Data Science

Binary Tree Zigzag Level Order Traversal[]


Given a binary tree, return the zigzag level order traversal of its nodes’ values. (ie, from left to right, then right to left for the next level and alternate between). 175 more words

Leetcode

Path Sum[leetcode]

Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. 153 more words

Leetcode

Word Ladder

Problem:

Given two words (start and end), and a dictionary, find the length of shortest transformation sequence from start to end, such that:

  1. Only one letter can be changed at a time…
  2. 294 more words
Technical And Interview And Data Science