Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [search]

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

Filter by
Sorted by
Tagged with
2 votes
1 answer
77 views

Speed up searching for the lowest element that is not in the array

I try to solve this question: B. Informatics in MAC at Codeforces To solve it, I think I need to calculate the prefix and suffix array of MEX. I made observation that making only 1 subsegment will ...
3 votes
1 answer
60 views

A search function that searches for a contact inside a vector

I have this function to search for a specific contact inside a contact management program. I want to know the following: Is returning the contact object as a pointer(...
1 vote
0 answers
52 views

Principal Variation Search (PVS) for playing Connect Four in Java

This time, I have an implementation of PVS (Principal Variation Search) algorithm for playing the game of Connect Four. The repository holding the above .java file ...
4 votes
3 answers
273 views

Connect4.java - The Connect Four game against an Alpha-beta pruning -based AI bot

I have this GitHub repository. It implements the command-line version of the Connect Four game. The AI bot is implemented via Alpha-beta pruning. Code ...
4 votes
0 answers
104 views

Performs interpolation binary search over an array. If value found returns found and index else returns not found and insertion index

Performs interpolation binary search over an array sorted in ascending order. If value found returns found and index else returns not found, the insertion index is returned. Assumptions : data is ...
3 votes
1 answer
130 views

Incremental upper bound in sorted range

Since initial question Increasing binary search for mismatch in sorted range contained defects in code and can confuse the readers, here is the updated version of the question. Is the code below ...
3 votes
1 answer
86 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 ...
2 votes
1 answer
117 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 ...
2 votes
1 answer
98 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 ...
3 votes
1 answer
180 views

Fast search for the longest repeating substrings in large text

Is there a chance to implement the code below better with the features of recent C++ versions? Functional specification Having a large text and already built prefix array find the longest substrings (...
5 votes
1 answer
94 views

Local Search Engine in Rust

I made a simple search engine using the xkcd API in Rust which turned out better than I'd hoped for! I decided to use tf-idf as a way to rank results, which I feel like has some room for improvement. ...
4 votes
2 answers
486 views

Spatial radius search in Boid simulation

I am working on a Boid simulation with 10,000 boids. I've successfully utilized geometry shaders and an array<GLfloat[3], MAX_BOIDS> for vertices to enhance ...
4 votes
2 answers
1k views

Object key diff

I've been tasked with finding property differences in massive JSON structures and returning them in a particular fashion (i.e. [key_1.key_2, key_1, etc.]). Here's ...
2 votes
0 answers
79 views

Javascript basic search engine recipes

I have made a search engine for recipes. Requirements for this JS Project are as follow: Create a function called searchRecipes that takes all recipes and an ...
4 votes
1 answer
52 views

JavaScript search algorithm to find a town in a particular state

I built a function in JavaScript which executes a search algorithm to find a town in a particular state. The dataset, referenced by the variable townsAndStates is ...
5 votes
2 answers
460 views

Optimizing a node search method given a 2-D spatial point

I have a tree-like structure called grid. I have designed it as a structured numpy array. Each element of grid is a tree-node. ...
3 votes
1 answer
329 views

Algorithm Challenge: Fuzzy Search

I recently took part in an algorithm challenge to create a Fuzzy search with the following criteria: Given a set array, create a function that receives one argument and returns a new array containing ...
2 votes
2 answers
68 views

Given a sorted list of integers, find the highest count of elements between an indeterminate but fixed size range

I'm trying to optimize a function that takes a sorted list of integers and tells me what is the maximum number of elements in the list between any definite size range. To be clear, the range itself ...
-2 votes
2 answers
405 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 ...
7 votes
2 answers
489 views

Copy file with text replacement

I am currently learning C++. I coded a tiny program for school and I wonder if there could be issues (like bugs or security issues) with it. Any ways to make it have weird behaviours would be very ...
2 votes
1 answer
105 views

python function for searching videos in Vimeo

https://github.com/floris-vos/vimeo_search_python I made a small function that takes search terms as arguments and returns a dictionary with items, each holding an URL, title, duration, channel, and ...
3 votes
1 answer
275 views

`nov.el` function to search the entire `epub` ebook

nov.el does not provide an easy function to search the whole of the ebook content. Every search performed on buffer only applies to the "document" or ...
3 votes
1 answer
157 views

Swift - efficient array searching

I am trying to find a way to search an Int array (all numbers are > 0) and identify sequences where the sum of each element is a specific number. One element can ...
3 votes
3 answers
381 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 ...
1 vote
0 answers
26 views

Optimizing search algorithm for guessing list of strings via function returning bool if substring is in list [duplicate]

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 ...
user avatar
6 votes
1 answer
169 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 ...
6 votes
4 answers
937 views

Counting the number of patterns that exist in a particular string

I am solving this problem where the function returns the number of times a pattern is found in a said string word. It could be easily solved via ...
1 vote
2 answers
586 views

Find the newest file that contains a specific string in every subdirectory of the path using the least resources

I have a server side logs folder that contains many hundreds of logs most of which are in subdirectories according to the machine the logs have come from. The task is to extract the full path of the ...
7 votes
3 answers
5k 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 m x n ...
6 votes
1 answer
145 views

Implementation and Testing of Exponential Search for scenario where we search the same array/list many times

Exponential Search is an optimization over binary search. Conceptually, when searching for a number target in a list of numbers ...
1 vote
1 answer
634 views

Sort and search vectors by different criteria

Class class Player { std::string name; int score; int id; }; I thought about how to write a code to sort and search vector ...
1 vote
1 answer
2k views

Finding nodes with 0 or 1 parents - DFS or BFS

I completed the following question but it seems a lot of space complexity. Do you think is there a way to complete it with graph search or so? Thanks for the comments. Suppose we have some input data ...
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 ...
1 vote
1 answer
104 views

Shorten code in search function of an inventory app

Introduction I want to create an Inventory App in C#. I was thinking of someone who sells a few products and only needs to have a few product properties in the program to search or sort by, and then ...
35 votes
10 answers
9k views

Search for a multiword string in a list of strings

Unlike Perl, you can't to my knowledge match a regular expression inside an if statement in Python and assign the result to a variable at the same moment. This ...
0 votes
1 answer
906 views

Fastest string search algorithm

I have invented the fastest string search algorithm. Can someone prove that it is not fastest? I am not considering worst case scenarios. The algorithm can be found here: https://sourceforge.net/...
1 vote
2 answers
494 views

Requiring query field to not be empty on search api

we have a RESTful API that includes an endpoint for search apiserver/v5/search?q=[search text] for any query, it passes it off to solr and returns the result like ...
0 votes
1 answer
97 views

Search Engine in PHP having new architecture

I have invented and implemented a new search engine architecture. This search engine has been developed mainly for English Alphabet. This search engine is based on the fact that no letter in English ...
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 ...
1 vote
1 answer
296 views

Get Interval by specific value from List using JAVA 8

First let's introduce the problem: I have a list like [{10,18}, {19,25}, {26,50}] and i have an input (n), when (n) inside one of objects in a list i will get this ...
3 votes
2 answers
100 views

Search code that performs in-memory search

This is the code I came across in our repository. This performs search in-memory and is invoked on service layer code. In our front end operators like EQUAL_TO and ...
2 votes
1 answer
60 views

Please verify Jump searching algorithm

Please verify jump searching algorithm that I have written and let me know if any bugs are present. I have tested it from my end, but still would like to get it verified for any missing corner ...
8 votes
3 answers
2k views

Java TreeMap.floorKey() equivalent for std::map

I wanted something equivalent to this Java program: ...
7 votes
6 answers
4k views

C++ implementation of depth-first search

I got the C++ implementation of depth-first search (DFS) from here and made slight modifications to it. The modified code is as follows: ...
9 votes
2 answers
1k views

Exponential search

I recently discovered the exponential search algorithm which can be used to find whether a value exists in an ordered range. An exponential search checks whether a value is smaller than the \$2^n\$th ...
1 vote
1 answer
54 views

Python Prime Search Slower Optimization

I have these 2 version of code. Both are looking for all primes under a certain ceiling value. The first is testing against the set of all odd numbers. The second in testing against the set of all 6k-...
2 votes
1 answer
185 views

Rxjs search in Angular

I created an rxjs search for a hiring company, but I got rejected for the following reason: -performance issue on a bigger data set. -bugs My question is how can I make this code better for the next ...
4 votes
1 answer
88 views

Find optimum teams given calendar availabilities

I'm designing an algorithm that creates optimum teams based on everyone's availabilities (maximizes the amount of shared availability). To this end, I've made a function that takes in a dictionary of ...
2 votes
2 answers
197 views

Searching within a data model using an array matching multiple terms

I have a standard tableview app that displays information from a data model array that uses a custom class. There is a UISearchController to filter the data. A ...
4 votes
1 answer
344 views

Indexing and searching an list of rectangles to see if they contain a point

I have a flat list of rectangles, in the following format (id, x co-ord, y co-ord, height and width): ...

1
2 3 4 5
8