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

learn more… | top users | synonyms

0
votes
0answers
28 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 ...
-3
votes
0answers
18 views

Modify the given sequence such that after several operations all elements are zero [closed]

The is the given problem on HackerEarth: Suppose we have a sequence of non-negative integers, Namely a_1, a_2, ... ,a_n. At each time we can choose one term a_i with 0 < i < n and we subtract 1 ...
2
votes
1answer
52 views

Finding a path across a grid after randomly filling some proportion of it

Essentially, we must be able to get from one side of the grid to the opposite side of the grid. My code tests for up to down and left to right. However, this is painfully slow and I'm wondering if ...
3
votes
0answers
33 views

Filtering search results for apartment and car rentals

I am developing an app which is somewhat similar to airbnb. There are two search function, one for searching apartment and other for searching car rental. When searching apartment, the result page ...
0
votes
3answers
89 views

Find the smallest 3 numbers from a total of 5000 numbers

Today was my interview. The question which was asked was: Give an efficient solution to search smallest 3 numbers from a given array. The array contains unsorted numbers which can also ...
1
vote
0answers
69 views

Ice Cream Parlor

Each time Sunny and Johnny take a trip to the Ice Cream Parlor, they pool together m dollars for ice cream. On any given day, the parlor offers a line of ...
1
vote
3answers
126 views

Missing Numbers

Numeros, the Artist, had two lists A and B, such that B was a permutation of ...
0
votes
1answer
51 views

Search function for books

I was making a library program for trying to practice C++. I wanted to use a vector to store all the books, the books being a struct to hold the general things the books would have. ...
2
votes
3answers
95 views

Fast find exist in list or not

I want to determine whether or not the selected element exists in the list. This is the current procedure that I'm using for finding the element exist in a list or array. Is there any fast procedure ...
5
votes
1answer
73 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 ...
5
votes
1answer
312 views

Find all strings in list which have keywords in it from another list

I a list of strings A and a list of keywords B. Now I want to return all strings from list A which have all keywords from B in it as a new list. ...
2
votes
2answers
93 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, ...
0
votes
1answer
44 views

Sentinel based find with conditional fallback to std::find

I've got bored, so I decided to write a code using ancient knowledge of sentinels. Sentinel based find Basically what we do is put value that is needed to find at the end, and then write an endless ...
3
votes
0answers
78 views

Solving Sudokus in Scheme Using Simulated Annealing

This program's purpose is to solve sudokus using simulated annealing. It first fills all the 3x3 blocks in the sudoku such that every block is filled with 1-9. It also builds a list of pairs of ...
3
votes
1answer
96 views

Detect if string contains more than 1 period

This function returns true if the string contains zero or one periods, and returns false if the string contains more than one ...
1
vote
1answer
86 views

Check if strings are substrings of another string in Python

My problem starts with a list A (length around n = 100) of big strings (around 10000 characters each). I also have another q = 10000 strings of length 100. I want to check if each string is a ...
3
votes
2answers
111 views

PHP surround search text with words

The requirement: search a string in a text-string (from DB) and show additional info around when presenting the result. Examples: text string = "The Quick Brown Fox Jumps Over the Lazy Dog" search =...
3
votes
3answers
195 views

Parameterized search query in C#

In the UI I have a single search text box into which users can type a query. The query will split the string and compare each word to each configured column in the database and return the matches. ...
7
votes
1answer
180 views

Search in a JSON structure after a key

This code is supposed to search for a specific key in a object or an array or a mix between both. Is there anything I can improve? ...
3
votes
1answer
85 views

jQuery Search Suggestion Generator

I'm currently using a PHP shopping cart, and finally decided to implement a search suggestion feature. There are some already available solutions out there, but I wanted to gain control over how mine ...
0
votes
0answers
31 views

JQuery Search Suggestion Generator

I'm currently using a PHP shopping cart, and finally decided to implement a search suggestion feature. There are some already available solutions out there, but I wanted to gain control over how mine ...
2
votes
2answers
141 views

Class name search algorithm

Here is a test task from a company, where I'd like to work eventually. I solved all they wanted to me to do, however failed to get an interview. I do not know what is wrong with my solution, because ...
1
vote
2answers
189 views

Binary search function in C#

I was wondering if I can make this better: ...
6
votes
2answers
64 views

Search for longest substring in alphabetical order in a given string

I would like some help with a review of a program that I wrote to identify the longest continuous sub-string that is in alphabetical order within a string. This is a JavaScript adaptation of an ...
0
votes
0answers
31 views

Function to gather several types of search results

Following is my code, ...
0
votes
0answers
53 views

Merging results of product searches by category, price, and manufacturer

Following is code which takes three arguments as String Map String now I already have some predefined methods which return the requirement of both String as List ...
2
votes
1answer
83 views

File search program not efficient enough

I have created a program to search for a file in the computer. But I feel it can be improved. Can anyone help me with this? filesearch.py ...
2
votes
1answer
68 views

Filesystem search class in C#

Anyone can tell how to make this code faster? This search takes too much time... 700 000 files for 15 minutes... I will be grateful for each micro optimization! Search Class: ...
6
votes
2answers
91 views

Binary search a 2D array for multiple matching criteria fields

Here is what I came up with for a binary search of an array. It allows for searching one or many columns to match. It assumes that array being searched is sorted with the same sort priorities as the ...
1
vote
2answers
58 views

Searching local drive for multiple files

Well, I'm writing a piece of code that will take a list of file names and should search a local drive for each file, determine if it's there or not, and return an array of all the paths found. Right ...
4
votes
0answers
48 views

Unstructured quantum search algorithm for unknown solutions

This code was tested on IBM's 5-Qubit processor as an implementation of Grover's search algorithm, but for an unknown number of solutions. This code is based on Arthur Pittenger's book, "An ...
10
votes
3answers
499 views

Read file with over 300k words and filter through appropriate filter to return list of matching words

As a puzzle we were asked to bring out the possibilities in breaking a 4 letter wordlock combination. It was to be a four letter word from the English dictionary. There were 10 possible characters in ...
3
votes
2answers
173 views

Product search script Object Oriented PHP

I have made a search script in OO PHP that searches for products based on the inserted criteria, selects them and checks whether a sale is on, if it's in stock and other features. I am new to OOP so ...
5
votes
1answer
65 views

Determining whether a date is within a range

I am taking a user input which consists of a from date and a to date. Those dates are compared against 4 cells in a row - a post date, pause date, resume date, and a close date. My goal with this code ...
2
votes
0answers
73 views

Query for searching for the best transportation

I made a website where is possible to search for the best transportation from a place to another. For instance, if I need to go from Berlin to Bremen, the website will search in its internal database ...
4
votes
1answer
106 views

Prints Books from a HashMap that are complete or incomplete

This code is meant to display book titles that are incomplete. I have a HashMap with the book title and a number that represents the amount of the book that has ...
1
vote
2answers
103 views

Excerpt from a brute force Rubik's Cube algorithm

I have a program that brute force searches for a combination of inputted array elements by the user and when the program is searching all the for loops are nested for the brute search then I have this ...
1
vote
2answers
103 views

Python Search file for string and read into list

This function of my program is searching a file that is formatted as first_name last_name rate hours: John Smith 25 80 Mary Johnson 15.5 60.0 ... With one space ...
6
votes
1answer
65 views

Checking if a line in a file contains user.Handle and '-r'+any single digit number

The title pretty much explains everything. I'm try to check if a line in a file contains user.Handle and '-r'+any single digit ...
3
votes
1answer
85 views

Filtering a list for certain strings

I want to create a function that filters a list with the following criteria: Strings containing numbers should be removed Strings containing only one word and first letter of the word is not ...
5
votes
2answers
58 views

Search files from large directory and sub-directories

Essentially I have a large directory with many sub-folders and different formats of files. It reads through XML, JAVA, .txt, etc, in search of a selected String inputted by the user. The results ...
1
vote
5answers
106 views

Ruby array search, returning either a result with a good score or the last result

I have an array of hashes, each of which has two attributes: "title" and "Zscore". I want to return either the result of ...
-1
votes
1answer
141 views

Searching into a contact list

I am performing search in a contact list using linear search with complexity \$O(n)\$. Please suggest me how to improve search strategy in my code. ...
1
vote
1answer
36 views

Object key diff

I've been tasked with finding property differences in massive JSON structures and return them in a particular fashion ([key_1.key_2, key_1, etc]). Here's my code, which is focused on readability so ...
5
votes
1answer
90 views

Sort a strings collection by a search term

I'm trying to implement a search bar in which the user sends a search term and the search bar displays the results. I have a naive solution which separates the original list into three sublists: a ...
5
votes
3answers
124 views

Composing and executing a customer search

I was wondering if someone could help me refactor this code. Although I know this looks bad, it works. Now I would like to refactor it so I would respect the open/closed principle in SOLID. Let's say ...
5
votes
3answers
185 views

Interview coding test: Searcher

I did a task for an interview and the solution was not accepted. The task was to implement the class search function by name. The number of classes in the input data from 0 to 100000. Class names are ...
3
votes
3answers
190 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: ...
4
votes
0answers
180 views

Shortest path navigation across a grid using Best First Search

The code below is an implementation of the Best First Search algorithm for navigation of the shortest path across a 2D NxN matrix. As a heuristic for the search I use the standard distance formula. ...
10
votes
1answer
157 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-...