Questions tagged [search]

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

Filter by
Sorted by
Tagged with
11 votes
1 answer
4k 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. ...
SohamC's user avatar
  • 221
12 votes
2 answers
612 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,...
janos's user avatar
  • 111k
5 votes
2 answers
487 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 ...
ndm13's user avatar
  • 718
3 votes
3 answers
361 views

Most effective search algorithm for guessing list of strings via function returning bool if substring is in list using Python

I trying to figure out the most effective way to accomplish this task: A function, check(), contains a list of strings. Calling the function with a string as ...
n0k's user avatar
  • 31
2 votes
1 answer
95 views

Fast search for the longest repeating substrings in large text (Rev.2)

This is the second iteration of the Fast search for the longest repeating substrings in large text code review. Special thanks goes to G. Sliepen who conducted the first review. Functional ...
Damir Tenishev's user avatar
156 votes
20 answers
32k views

Searching an element in a sorted array

I was applying for a position, and they asked me to complete a coding problem for them. I did so and submitted it, but I later found out I was rejected from the position. Anyways, I have an eclectic ...
user avatar
39 votes
5 answers
7k views

JavaScript binary search

I wrote an implementation of binary search in JavaScript earlier for kicks, but I noticed my version was significantly different than those found on Google. Here is an example of binary search I found ...
Reid's user avatar
  • 493
32 votes
4 answers
78k views

A* search algorithm

NodeData stores all information of the node needed by the AStar algorithm. This information includes the value of ...
JavaDeveloper's user avatar
30 votes
8 answers
50k 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 ...
Gokul Nath KP's user avatar
19 votes
4 answers
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 ...
rolfl's user avatar
  • 97.3k
12 votes
4 answers
8k views

strstr() implementation

In this strstr implementation, I am basically skipping the already matched and checked characters with an if else condition. Is ...
Software Engineer's user avatar
11 votes
2 answers
1k 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 ...
david's user avatar
  • 1,947
11 votes
2 answers
14k 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 Name, ...
slow_excellence's user avatar
11 votes
1 answer
1k 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 ...
rolfl's user avatar
  • 97.3k
11 votes
2 answers
21k 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? ...
greenhoorn's user avatar
10 votes
2 answers
502 views

Naive implementation of KMP algorithm

After reading this answer to the question "High execution time to count overlapping substrings", I decided to implement the suggested Knuth-Morris-Pratt (KMP) algorithm. I used the pseudo-code listed ...
Graipher's user avatar
  • 40.9k
10 votes
1 answer
370 views

Fuzzy grep for fuzzy bears in pure Python

I am aware of the Python modules galore to do this, but this was partially a learning experience and partially all the functionality I need and no more. I'm writing a simple interpreter for a Forth-...
cat's user avatar
  • 977
7 votes
2 answers
1k views

Find and rename all png files

I have such problem : find all png files to disk and rename them as I did: ...
Lolidze's user avatar
  • 201
6 votes
1 answer
205 views

Randomizing and mutating algo class - functionality

See Randomizing and mutating algo class - style I'm looking for a review of the functionality of this code, answers to the above question which also describes the code use focus on style instead. ...
alan2here's user avatar
  • 289
6 votes
2 answers
200 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 ...
Eric Cochran's user avatar
6 votes
2 answers
6k views

Find a best fuzzy match for a string

I am trying to find a best match for a name within a list of names. I came up with the below code, which works, but I feel that the creation of the intermediate ...
barciewicz's user avatar
6 votes
1 answer
126 views

Bash command helper in C++

I'm writing a program to help with remembering complex bash commands. On invoking the program, it asks for a description of the desired operation, e.g., "increase volume" or "find orphaned packages", ...
Big McLargeHuge's user avatar
5 votes
1 answer
161 views

Text search in Python

Whilst self-studying algorithms, I came across the Karp-Rabin rolling hash search algorithm here. I decided to have a go at implementing it in Python: For ease of reading; the data-structure ...
Aidenhjj's user avatar
  • 2,373
5 votes
2 answers
130 views

Knuth-Morris-Pratt over a source of indeterminate length

Please review my generic implementation of the Knuth-Morris-Pratt algorithm. Its modified to search a source of indeterminate length in a memory efficient fashion. ...
Jodrell's user avatar
  • 539
5 votes
2 answers
318 views

Randomizing and mutating algo class - style

I've updated this question to be about code style only, as all of it's answered focused on this aspect. For the codes function, see Randomizing and mutating algo class - functionality ...
alan2here's user avatar
  • 289
5 votes
3 answers
11k views

Search in a big dictionary Python

I have a big Python dictionary with more then 150,000 keys every key has list value. This dictionary contains infinitive words as key and all grammatical forms of these words as values: ...
Yan's user avatar
  • 235
5 votes
2 answers
7k views

Search word in multiple files

I am writing a brute-force method to search for a word. Please review my code and tell me how I can improve it. ...
Sarah's user avatar
  • 151
4 votes
0 answers
160 views

Improved Knuth-Morris-Pratt over a source of indeterminate length

Following the successful review of my previous implementation. Please review my new, generic implementation of the Knuth-Morris-Pratt algorithm. Its modified to search a source of indeterminate ...
Jodrell's user avatar
  • 539
4 votes
4 answers
5k views

Wildcard search in C

In the effort to improve my C knowledge, I tried creating a wildcard search function: ...
AntonioCS's user avatar
  • 536
3 votes
1 answer
277 views

String.IndexOfAny(string, string[]) (lowest position for group of needles in haystack)

This is a follow-up to this question with bug fixes, question and code improvements from @dfhwze, @PieterWitvoet, @HenrikHansen, @t3chb0t. I am still hoping for an improved approach or algorithm ...
NetMage's user avatar
  • 412
3 votes
1 answer
76 views

Fast search for the longest repeating substrings in large text (Rev.4)

This is the forth iteration of the Fast search for the longest repeating substrings in large text (Rev.3) code review. Special thanks goes to G. Sliepen who conducted all the reviews. Functional ...
Damir Tenishev's user avatar
3 votes
2 answers
1k views

Search algorithms in julia

I've been trying to implement the basic search algorithms: Sequential search for ordered and unordered arrays and the binary search algorithms, as part of a package. So, this is the implementation: <...
Dawny33's user avatar
  • 295
3 votes
1 answer
3k views

Grid walk problem

CodeEval's "Grid Walk" problem is as follows: There is a monkey which can walk around on a planar grid. The monkey can move one space at a time left, right, up or down. That is, from (x, y) the ...
Nikolay Derkach's user avatar
3 votes
1 answer
511 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 ...
sundar nataraj's user avatar
3 votes
1 answer
554 views

Knuth–Morris–Pratt string search algorithm

I finally think I've implemented the Knuth–Morris–Pratt string search algorithm correctly, now time for that lovely criticism that causes me to learn! The code doesn't look all that pretty however it ...
Anonymous3.1415's user avatar
3 votes
3 answers
645 views

Case insensitive sub-string search

I found myself in a need of a function that checks whether a string is a sub-string of another string, in a case-insensitive manner. I found that there's no standard function to do this, so I wrote my ...
machine_1's user avatar
  • 581
2 votes
2 answers
231 views

A linear search implementation for any data type in C

I performed an "experiment" to test my understanding of pointers in C. I decided to write a linear search function that can work on any array provided there is an existing function to compare the ...
Hungry Blue Dev's user avatar
2 votes
2 answers
1k 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, ...
Maksim Dmitriev's user avatar
2 votes
2 answers
137 views

Repository searching code duplication

A followup question to this: IQueryable Extensions working on expression for collection property I am working on a project for a family member which involves the use of a database and a repository, ...
Chris Thompson's user avatar
2 votes
1 answer
101 views

Fast search for the longest repeating substrings in large text (Rev.3)

This is the third iteration of the Fast search for the longest repeating substrings in large text (Rev.2) code review. Special thanks goes to G. Sliepen who conducted the first two reviews. Functional ...
Damir Tenishev's user avatar
2 votes
2 answers
1k views

Best C# implementation of IndexOfAny(string, params string[])

Follow-Up question .Net provides String.IndexOfAny(string, char[]) but not String.IndexOfAny(string, string[]). The existing ...
NetMage's user avatar
  • 412
2 votes
2 answers
108 views

Search through each file in a directory, list number of instances of searched string

I am trying to open each file listed in Sheet2 Column A, search for a string of text located in Sheet3 Cell B1, list the number of instances this string appears in each particular file in Sheet3, and ...
minnow1's user avatar
  • 31
2 votes
2 answers
225 views

Run dir scan as fast and efficient as possible / clean code

I'm not a very experience python programmer. But I want to make my code as fast and efficient as possible as well as write it clean and therefore got the advice to share it here. So I'm having the ...
BenjaminK's user avatar
  • 161
-2 votes
2 answers
396 views

Fastest string search algorithm invented by me. It is called ""Choudhary String Search Algorithm""

I have invented the fastest string search algorithm. It is called ""Choudhary String Search Algorithm (choudharyStringSearchAlgorithm)"". I have compared my algorithm with Brute ...
user avatar