Questions tagged [searching]

For questions about various search algorithms.

For questions about various search algorithms.

138 questions
21
votes
4 answers

Algorithm wanted: Enumerate all subsets of a set in order of increasing sums

I'm looking for an algorithm but I don't quite know how to implement it. More importantly, I don't know what to google for. Even worse, I'm not sure it can be done in polynomial time. Given a set of numbers (say, {1, 4, 5, 9}), I want to enumerate…
Michael
  • 313
18
votes
4 answers

Lower bound for finding second largest element

In a recent discussion, I came across the idea of proving a lower bound for the number of comparisons required to find the largest element in an array. The bound is $n - 1$. This is so because the set of comparisons performed by every such algorithm…
user813
14
votes
2 answers

Twenty questions against a liar

Here's one that popped into my mind when I was thinking about binary search. I'm thinking of an integer between 1 and n. You have to guess my number. You win as soon as you guess the correct number. If your guess is not correct, I'll give you a hint…
13
votes
1 answer

The "find my car" problem: proper interpretation and solution?

This has been asked at least twice here, but both questions have accepted answers which are wrong. I don't really know any good way to draw attention to the question besides asking again and being a bit more careful about not accepting incorrect or…
djechlin
  • 5,452
12
votes
1 answer

Searching for a point on the real line

A pin is dropped at a random point $p$ on the real line, with $p$ determined from a normal distribution with mean $0$ and standard deviation $\sigma$. You are dropped on the real line at $x=0$ and tasked with finding the pin. You can move left or…
9
votes
3 answers

In what sense is “Uniform-cost search” uniform?

The name of Uniform-cost search in computer science is not instinctive since what part of it being "uniform" is not clear to me. Apparently uniformity is not about the cost of each edge - most of the examples handle edges with various costs. Can…
IsaacS
  • 211
  • 2
  • 8
6
votes
2 answers

Graph puzzles: Constructing graphs from tiles

There is a vast literature on the reconstruction conjecture which says that two graphs with the same deck $D$ are isomorphic. The deck is the multi-set of vertex-deleted subgraphs of a graph (which are called cards). I'd like to take the other…
5
votes
4 answers

Need an efficient algorithm to visit all nodes of a graph, revisiting edges and nodes is allowed

Update: This is my solution with Kruskal's Algorithm, although it doesn't take into account real "path". Brute force may be the only solution. http://www.youtube.com/watch?v=VbSwwos4R2E Hi, I want to know if there is an algorithm that allows me to…
5
votes
1 answer

Searching for rock-hard integers.

For integer $k\geq 0$ written $d_jd_{j-1}\dots d_1$, where $d_i$ are single-digit integers, define $$R(k) := \begin{cases} d_j^{d_1}d_{j-1}^{d_2} \dots d_{j/2}^{{d_{j/2 + 1}}}, & j \text{ is even.}\\ d_j^{d_1}d_{j-1}^{d_2} \dots d_{(j+1)/2…
4
votes
1 answer

Spacing of fence posts with minimal distance to other fence posts

Definition 1: A "fence" is a set of "fence post positions", where each pair of adjacent positions has the same difference (the spacing), e.g. $\{1,2, 3, 4\}$. A fence is described by three values ($\in \mathbb{R}$): lower bound ($l$), upper bound…
4
votes
3 answers

Finding Lowest Elevation Path Between Two Points

Let's say I have a matrix of values that represent heights with function $f(x,y)$ and I am trying to find the "lowest value path" beween two points. So this would be the reverse of hill climbing, as in optimization, taking gradient and following…
4
votes
1 answer

Term-document vs document-term matrix

I am not sure if this is the right website to ask this question but I cant figure out where else to get the answer so, please, dont be mad :-) As my bachelor thesis/project, I am trying to construct a short-scale search engine using TF-IDF measure.…
Smajl
  • 716
4
votes
2 answers

Median of medians algorithm

I am referring to the algorithm presented here used to find a good pivot: http://en.wikipedia.org/wiki/Selection_algorithm#Linear_general_selection_algorithm_-_Median_of_Medians_algorithm My question is I don't quite understand why the elements…
4
votes
1 answer

Optimal curve to find a lost person in a forest

I read a story about somebody getting lost in a forest, and, apart from sympathy, the following mathematical problem came to my mind. Suppose the lost person is sitting still at an unknown point in a square SxS forest (I saw a couple of questions on…
4
votes
3 answers

Minimum number of steps required to visit every corner of a rectangular grid

I am stucked at this problem: Suppose we have the following grid configuration (or matrix) $G\in \Bbb{M}^{\{0,x,y\}}_{m\times n}$ (I.e $G$ is a matrix that have $m$ rows and $n$ colums over the alphabet $\{0,x,y\}$) $$G= \begin{bmatrix} …
MathNerd
  • 2,527
1
2 3
9 10