Tags » BF's

Word Ladder

Question:

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. 195 more words
Coding Question

某大公司两道题

1. 求一个字符串,只包含0-9的digit, 并且所有的四位数字的组合都是这个字符串的
sub-string.

第一道题没有很好的想法。唯一能想到的就是从0000到9999遍历一遍,然后从空串开始,如果字符串已经有包括当前这个数,则跳过,如果没有,进一步看开头结尾有公共子串,就接上,如果没有,则append,最后得出的结果就是我们想要的字符串了。

2. 一个m*n float矩阵A,在每个格子可以向上下左右四个方向移动。 求左上角到右下
角的一条路径,使得路径上所有数字的乘积最大(路径上不能有重复的格子)。

第二道题只能想到用DFS把所有可能的结果都算出来,用一个visited的Hashset来存已经访问过的位置。

Algorithm

Penelusuran Pohon Biner Algoritma DFS(Stack) dan Algoritma BFS(Queue) dalam Bahasa C

Penelusuran Pohon Biner Berdasarkan Kedalaman dengan Algoritma DFS + Stack dan Secara Melebar (Level Order) dengan Algoritma BFS + Queue serta Implementasinya dalam Bahasa C. 1,520 more words

SaungKode

A CS Student Tried To Use BFS. What Happened Next Will Surprise You.

Abstract

This post is aimed for those peeps have little or no background in graph theory and programming/implementing algorithms in graph theory.

In Kahon Legacy… 4,129 more words

Processing

Programming concepts in real life - Algorithm

This is the second post on the series of interesting thoughts of “programming concepts in real-life”. Today it occurred to me that one fundamental concept of programming – algorithm, is also heavily used in real life outside the IT world. 310 more words

Programming

Java Data Structure Implementation : Undirected Simple Graph (BFS/DFS)

This program demonstrates the Undirected Simple Graph implementation using link list, Queue & Stack in Java.
The Operation implemented :
1. Insert Vertex/Edge,
2. Delete Vertex/Edge, 1,089 more words

Java Data Structure Implementation

Algorithm #9 : Depth- and Breadth- First Search

This post is about the graph traversal algorithms, Depth First Search (DFS) and Breadth First Search (BFS).
BFS and DFS are one of the algorithms for graph exploration. 1,329 more words

Algorithm