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

learn more… | top users | synonyms

2
votes
2answers
46 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
5answers
728 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
58 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 ...
2
votes
3answers
65 views

Searching text for a string

This is my current code: ...
8
votes
1answer
69 views

Karp-Rabin with bitwise hash

As a Rags-to-Riches re-implementation of the Karp-Rabin question here, from @tsleyson, I thought it would be interesting to understand the algorithm better, and to use bitwise-shifting instead of ...
1
vote
1answer
71 views

String search & replace in C

I created a function to do that, and I want to know if there is a problem I'm overlooking about it .. ...
6
votes
1answer
131 views

Excel VBA binary search class module [closed]

I have a long list of sorted strings in a Workbook, and I have to find a lot of values in it. I was hoping to build a binary search Class Module that will find them for me faster than Excel's built-in ...
5
votes
2answers
95 views

Simple search engine using TF-IDF (200 LOC)

I wrote simple search engine based on TF-IDF statistic and cosine similarity. I am still learning Scala, so would be glad to hear comments (here or at GitHub) regarding my code from Scala ...
2
votes
1answer
41 views

Saving search history with many checks and validations inside

I am absolutely confused by saveSearchHistory function. It seems dirty and unobvious. Should I refactor it, and how? SearchHistory.java ...
11
votes
1answer
124 views

Case-insensitive String search in Array

Wrote this function for a Stack Overflow answer. It started off pretty bad but in the end I polished it a bit and now I have something I think to be pretty clean. Actually, when I look at the code, ...
13
votes
5answers
299 views

Fastest way of removing a substring from a string

Taking a break from my C++ series, I recently reviewed the code in this question. I ended up writing my own separate derivation of the function so that I could remove all of the substrings from a ...
3
votes
0answers
48 views

Find binary sequence in NumPy binary array

As part of creating a software defined receiver and decoder, I want to find sync pulses in weather satellite data. The data is first digitized to a 0-1 array. The code below is working. The ...
2
votes
0answers
41 views

MySQL natural search and like search

I have written two queries for searching, but I want to simplify them as it seems needed. ...
3
votes
1answer
68 views

Test if two nodes in binary search tree are cousins

Cousins are nodes at the same level of the tree, with different parents. They don't have to share the same grandparent. My solution depends on having a binary search tree with unique elements. This ...
8
votes
2answers
117 views

Searching a Word Document from Excel

Today I created a script in Excel that migrates data from a specific Word document and copies a portion of it to a cell in Excel (the date to be specific). The file input is Last name, First ...
2
votes
1answer
119 views

Node.js JSON searching & updating

I'm working on a web-based on/off controller for multiple switches. I'm looking for a good way to manage the current state of a switch and updating the current state on change. So far I've got a ...
7
votes
1answer
210 views

Binary search an integer array

I'd like this code to be improved ...
3
votes
1answer
73 views

Simplifying linked list “search and delete” function

The function asks the user for a value to search for, then deletes all matching values in the list. The program runs flawlessly, but I can't figure out a simple/elegant way of separating cases for ...
4
votes
2answers
173 views

Searching through various PDF files

I'm just looking for advice on how I can get my code to operate faster. It's pretty quick right now with searching through 30 3-page PDFs, but I imagine once there gets to be thousands of files to ...
7
votes
2answers
98 views

Program to find the element in an array

I'd like this code to be improved. ...
4
votes
5answers
270 views

Search algorithm for specific values in a 3D array/matrix being super slow

I'm trying to create code that reads a text file (containing (double) numbers between 0 and 1) and filling up a 3D array/matrix (calling it matrix from now on) with ...
2
votes
1answer
197 views

Typeahead Talent Buddy

Problem is Talent Buddy. Your task is to write a function that prints to the standard output (stdout) for each query the user name that matches the query if there are multiple user names ...
1
vote
1answer
60 views

Search a file system for files that match a given pattern

My concerns with this code: Is there a more efficient way to find files by pattern in Python? Does os.walk() work in Windows? Is this code pythonic? Should ...
5
votes
2answers
76 views

Finding the best matching block/patch in Python

I wish to locate the closest matching NxN block within a WxW window centred at location (x,y) of a larger 2D array. The code below works fine but is very slow for my needs as I need to run this ...
5
votes
4answers
253 views

Faster method to find data using search word?

I need to search through a string array to find every occurrence of "Parameters Table", and between each "Parameters Table" and the next, get another string from a specified index (that remains ...
7
votes
4answers
374 views

File text searcher

I have a working version of a logfile searcher that targets a specific directory by extension type, and searches the files for certain words. I'm wondering if my method is the most efficient ...
4
votes
1answer
70 views

“Good” Blob search

I written this code to search 'blob' items (text files) on the basis of their content. For example, if I search for "Good", then the names of files that contain "Good" or "good" should appear in the ...
6
votes
2answers
365 views

Z-Algorithm for pattern matching in strings

I was trying to refactor the following Python code (keeping the same time-complexity) which is an implementation of Z-Algorithm for pattern matching in strings. ...
0
votes
2answers
323 views

How to search for a word in a sorted text file efficiently?

I want to write my own program to search for a word in a sorted text file. In the text file each word is in one line. I want to write this myself because I did not find any simple program (without ...
8
votes
1answer
99 views

Speed up my search

I have a django app with search powered by haystack. The general search goes very quickly, but I need to filter the results by their model type. It works but is very slow. I've never really worked ...
1
vote
1answer
40 views

Correct use of Joins & Wheres

I have 3 tables, 1 where voters information is stored, 2 where their address is stored and 3 where voter id's are matched with address id's. I thought this approach was best as several voters can ...
13
votes
2answers
180 views

Hmm, a thoughtful library

I've been writing far too many routines in JavaScript that get a record from a an object or array based off a matching property, much like jQuery does with DOM elements. Since all the good names are ...
1
vote
1answer
168 views

Multiple search filter like the one in freshdesk

I have requirement to apply multiple filters on database. I will have multiple conditions in the front end where the user can select the conditions he wants to filter with and then see the output. ...
17
votes
8answers
4k views

Find all the missing number(s)

Recently I've attended an interview, where I faced the below question: Question: "There is an sorted array. You need to find all the missing numbers. Write the complete code, without using any ...
1
vote
1answer
57 views

Search a value across 2 array

I want to find the corresponding hash in an array from a string that contains a criterion defined in a hash of the array. I do something like that : ...
1
vote
2answers
123 views

Text file searching using SQL

I have the need to search a directory containing 1000+ files on remote servers where I only have access to SQL Server Management Studio and Explorer. I have written the below SQL statement which does ...
6
votes
2answers
99 views

Searching for files in a specified directory

I am currently writing a program that allows me to search for files in a user-specified directory. My current code is as follows: ...
1
vote
0answers
31 views

Binary search with heurisitcs or something else

Currently I'm using a binary search algorithm to search an index of a tree that represents an XML file. Can I use heuristics to improve the search? What can I do to improve this search function? ...
10
votes
4answers
913 views

Find byte[] in byte[] with Java

I made a search method because I want to use binary data like PNG files. The point of this is to be able to find strings like IEND in a PNG file. I think it works ...
5
votes
1answer
387 views

Searching in a sorted 2D matrix

If I was at an interview, and wrote this code, what would you think? Please be brutal. Time it took to wrote it: 13 minutes Problem: Write an efficient algorithm that searches for a value in an ...
2
votes
1answer
525 views

Search filter list using jQuery

I looked at a search filter code code and edited it to catered to my functional needs. I understood most of the JavaScript except the extend method bit. Can someone explain that? Also, is this the ...
6
votes
1answer
69 views

indexOf() and Boyer Moore methods

I have a method I created which is a custom indexOf(). This code seems ugly to me so I was wondering if anyone could recommend a cleaner and perhaps faster ...
8
votes
5answers
1k views

Efficient pathfinding without heuristics?

Part of my program is a variable-sized set of Star Systems randomly linked by Warp Points. I have an A* algorithm working rather well in the grid, but the random warp point links mean that even though ...
12
votes
6answers
20k views

Fast way of searching for a string in a text file

I have written this code to search for a string in a .txt file. Is it possible to optimize the code so that it searches for the string in fastest manner possible? ...
5
votes
1answer
96 views

My attempt at a weighted search in JavaScript

I tried to make a weighted search function in JavaScript. I've been improving my JS lately but still not sure about some best practices, wondering if there's any improvements I could make, or if I've ...
6
votes
3answers
175 views

How to extract elements from multiple sorted list efficiently?

Problem Statement:- I was ask this interview question recently.. I was able to come up with the below code only which runs in O(k log n)- Given k <= n sorted arrays each of size n, there exists ...
10
votes
2answers
281 views

Finding an element in multiple sorted lists efficiently

I have \$k\$ sorted Lists, each of size \$n\$. Currently I have hard-coded 5 sorted Lists each of size 3, but in general that is ...
8
votes
3answers
941 views

Scrabble algorithm review and performance suggestions

After finishing Project Euler 24, I decided to make a scrabble type of application using /usr/lib/dict as my dictionary what I cat that into a word file. It does take a few seconds, and the dictionary ...