Questions tagged [search]

This tag is for questions about search algorithms, tools, and technologies.

Filter by
Sorted by
Tagged with
2
votes
2answers
2k views

Breadth-First Search heuristics to find solution to Water Jug Challenge

I started learning AI recently. In AI, searches should be avoided and everything in AI is a search problem. One of the easiest problem where we could use general AI search techniques is the water jug ...
4
votes
2answers
237 views

Calculating the number of steps it takes to get from point S to F

I have following Java class called TheNewMario. It reads a String path and iterates through the path from ...
7
votes
1answer
502 views

Implementing a (small) full-text search in Ruby

I'm trying to implement a small full-text search in Ruby. I feel like I've laid down the foundation but I've encountered a blocker that has gotten me thinking that something with the design is ...
3
votes
1answer
817 views

Breadth-first tree cutting

I have a working solution for 'Cut the tree' problem but it is not fast enough. Problem Statement: Atul is into graph theory, and he is learning about trees nowadays. He observed that the ...
4
votes
2answers
221 views

Searching within multiple objects of the bucket

I have millions of files in the Google cloud storage's bucket. I want to search within files with a .index extension and retrieve the contents. This is currently what I am doing, but the time ...
0
votes
1answer
2k views

Laravel Controller including sort and search

I am using this code on my own personal website (my personal administration site) so it doesn't need any security and so on. I am not into learning everything about that yet, and although I do know a ...
3
votes
1answer
227 views

Small BM25+ implementation for probibalistic result ranking

I came up with this small implementation of an Okapi BM25+ ranker using Ruby. I cooked it up in a very short time so it's very simple but I'm trying to think whether there's a better way to write it. ...
2
votes
1answer
129 views

Pattern search in a text

Is this a practical algorithm for pattern matching in a text? Assume text can be very large, is there anything I can do to speed up the performance? ...
6
votes
2answers
1k views

Contact search application

Create a C++ program which will act like contact search app in mobile. For example, if the following contacts are saved in contact list: Massi Pradip Prasad Praveed Raju ...
1
vote
1answer
255 views

Search module in JavaScript

I implemented search module, but I'm a novice in programming and I'm not sure about public and private functions that I coded. Did I do it right? ...
2
votes
1answer
669 views

Graph, and a search that visits each edge exactly once in each direction

My assignment was to write a method that is capable of visiting each edge in a graph in each direction exactly once. With it, I included a basic Graph class to test it with. What I'd like a review ...
3
votes
1answer
190 views

Substring searching with Knuth–Morris–Pratt

My program uses the Knuth–Morris–Pratt algorithm to search for a particular substring in a .txt file and then store it in a binary search tree. Note that ...
10
votes
2answers
572 views

Minimum sub-array challenge

Below is my solution to finding the minimum product sub-interval. It passed 8/12 or so test cases, but the other test cases timed out if they hadn't finished within 2 seconds. When I compile this code ...
4
votes
4answers
5k views

Hackerrank's Sherlock and Array

Challenge can be found here Problem Statement Watson gives Sherlock an array A of length N. Then he asks him to determine if there exists an element in the array such that the sum of the ...
2
votes
1answer
901 views

Laravel 4 search function

I am using this code in my controller and would like to know if this is good code to use or if I can write it better, or more compact, and so on. I am just trying to learn from this. It does work, so ...
5
votes
2answers
100 views

Wildcard string search with capture

My goal was to create a function as performant as possible with results being: True/False as to whether wild matches str. ...
8
votes
3answers
792 views

Search string for a substring - indexOf

I am trying to write my own implementation of indexOf for learning purposes. I have an implementation of as follows. I'm sure a more efficient and shorter ...
5
votes
1answer
159 views

First attempt at weighted search

My concern is speed, since this may be used in an e-commerce website I want it to be as quick as possible. Where can I improve? ...
5
votes
2answers
469 views

Multi-threaded domain status checking in Java

I'm tinkering with the idea of crafting a search engine in my spare time. More of a learning experience than anything at this point, but still a project. A key aspect of this system is checking ...
3
votes
1answer
71 views

Yellow Pages Search

I've written code in Free Pascal based on a contest problem (The contest insists that I have to write with Pascal). It works like charm, but I think it still need some improvements, from memory usage ...
2
votes
3answers
604 views

Searching a string of consecutive characters in a binary bar code

I am writing a program that will take a binary bar code and convert it to a zip-code. I need to validate the bar code. A valid binary bar code contains no more and no less than two 1s in any position ...
4
votes
2answers
97 views

Search key in a rotated sorted array without repetition of elements

Is there any improvement possible in this implementation? ...
6
votes
2answers
8k views

Find largest block in matrix

(Largest block) Given a square matrix with the elements 0 or 1, write a program to find a maximum square submatrix whose elements are all 1s. Your program should prompt the user to enter the number of ...
3
votes
2answers
50 views

Search utility that searches through source code files

I'm working on a search utility that searches through source files. It's only the beginning of the project. It lacks a lot of features, but a backbone of the project works and it would be great if you ...
12
votes
3answers
13k views

Suffix tree implementation in Java

I was trying to solve the problem where given a larger string and an array/list of smaller string, we need to make the determination whether the larger string contains each of the smaller strings. I ...
5
votes
2answers
8k views

HackerRank Grid Search challenge

I’ve written an answer for The Grid Search challenge on HackerRank. Please let me know of any improvements that can be made to my implementation (specifically if there's any way to make the algorithm ...
3
votes
1answer
403 views

Find minimum element in a rotated array

Here's an implementation of finding the minimum element in a rotated array using binary search (one that is sorted in ascending order, and all elements are distinct). Please let me know of any ...
3
votes
1answer
63 views

Song search app with dynamic tables

I decided to make a Ruby app to search for songs, which uses the tinysong API. Things got really cryptic and weird in the view. I managed to get dynamic tables that adjust to data length, but I feel ...
2
votes
2answers
37k views

Find index of an object with a specific value stored in an array

I am using the following code in order to retrieve the index for an object stored in a JavaScript array. Scripts works fine, but I would like your opinion regarding performance. Also would like to ...
5
votes
3answers
838 views

Complex search program

I am working on a fairly complex (at least it feels complex to me at the moment) search program and am looking to possibly increase the performance. Everything works exactly how I want it to, but I'm ...
5
votes
1answer
724 views

Abstracting the process of finding the index of the maximum in Python

Suppose I want to find the index of the maximal value of a given sequence. In Matlab, this is: [value, index] = max(x) In Python, I would abstract the following ...
2
votes
4answers
12k views

Java String search and replace [closed]

I would like to search a String, and for a certain word, I would like to change only the first 3 letters For example: This is a java institute which insures ...
4
votes
1answer
468 views

Optimizing variadic template pack subsequence matching algorithm

I'm building a small MPL module in one of my utility libraries for fun and learning experience. One of the problems I'm trying to solve is getting a list of all indices where a sequence of types ...
12
votes
2answers
598 views

Finding a word within a pre-defined set using a search string with wildcards

The other day I was intrigued by this question (originally from here): Write a program that answers YES/NO search queries containing * placeholders. Example: if the data you have is (hazem, ahmed,...
2
votes
2answers
979 views

A set of names and a request with asterisks

I have a set of names and a request with asterisks. An asterisk can be replaced with any letter. For example, there is a set of names: hasad, ahmed, fizo. And there are a few sample requests: hasad, ...
6
votes
2answers
1k views

Find element in sorted matrix

Find an element in a MxN matrix where each row and column is sorted in ascending order. Any comments on my code? (I added some test cases on non square matrices which I did not copy here) ...
7
votes
5answers
174 views

Recursive filename search

I have created a little program to search a set of folders holding documents scanned. The folder structure is as follows: c:\images\year\month\date\documenttype\firstpartofdocumentNo.\ the ...
5
votes
1answer
16k views

Java Word Search Solver

This is a challenge up on Programming Praxis, however there are no Java solutions, and there are few Java implementations elsewhere on the internet. Most of these implementations simply search the ...
3
votes
2answers
252 views

Searching for nodes in a huge tree

This is supposed to search for a node in a huge Treeview. The node could be found in many places. In other words there may be many nodes and the resulting tree should be expanded depending on where ...
9
votes
3answers
21k views

Get values between two dates

I have a search form where users can enter ValidFrom and ValidTo dates, There are three conditions: ...
11
votes
2answers
16k views

Powershell search millions of files as fast as possible

I once asked a similar question but in C#. Now I have the same problem in powershell.. What is the fastest way, to search files newer than 15 minutes, in a file system with more than 1 million files? ...
3
votes
3answers
8k views

Search through .xml files for text that exists anywhere in the file

I have about 1000 .xml files in different sub directories under one root folder. My root directory contains the below structure: RootDir\172\00ad8dc-bff\25.0.xml <...
2
votes
1answer
174 views

Small generic path search framework in Java

I have this small generic path search library. It's not perfect at all, so I need some comments as to have a chance to improve it. com.stackexchange.codereview.graph.model: AbstractHeuristicFunction....
19
votes
4answers
1k views

Name Filtering using a Trie

This question suggests a different (improved?) implementation for searching/filtering names based on a search query. This is based on the question here: Name filtering in Java A Trie allows the ...
6
votes
2answers
180 views

Name filtering in Java

I have a search box for searching for people in a list of names. Here is the code that runs every time the query changes. I could not find anything open-sourced for this, so I wanted to make sure ...
4
votes
1answer
2k views

Search algorithm to find a point from a given X value

I implement the following algorithm in order to find a point from a given X value in a sorted list with the same distance between each X values. Here's an example of my list content with a delta of 10:...
5
votes
3answers
267 views

Search arrays for values

I implemented a search function like this: ...
3
votes
2answers
11k views

Fastest way searching specific files

I got thousands of files with a specific file extension in thousands of sub folders. Now, what is the fastest way to search with a pattern? I tried the method ...
4
votes
6answers
2k views

String vs List to check if a country is part of a continent

I simply need to check if a country is part of a particular continent (only one). The continent has around 50 countries. The list is constant and must be initialized at the time of creation. Which one ...
3
votes
2answers
15k views

8 Puzzle solver A* search

I recently created this for a coursework assignment. I am always looking to learn and would like some feedback on my code. Is there any OO principles I'm going against or anything irritating I'm doing?...

1
4
5
6 7 8