Questions tagged [search]
This tag is for questions about search algorithms, tools, and technologies.
383
questions
9
votes
4
answers
247
views
Stream text scanning
I've written some utilities to read text from streams. One of these, the ReadTo method, is to read text from a specified stream until a given text is encountered, ...
1
vote
0
answers
395
views
Fast text search in Rust
I have a large file that I want to search for text as fast as possible. There is not a memory contraint, so I am loading the entire file into memory so that I can use the rayon parallelism crate in ...
1
vote
1
answer
68
views
How can I make my filter search code more efficient?
Here is App.js
...
6
votes
2
answers
2k
views
Javascript - Find a deepest node in a binary tree
Problem Statement
Given the root of a binary tree, return a deepest node.
For example, in the following tree, return d.
a
/ \
b c
/
d
My ...
5
votes
4
answers
326
views
C-based hash matching cracker
How can I improve this hash matching program using either abstraction or search/sort algorithms?
We briefly were introduced to searching methods such as bubble sort and merge sort, but I'm not sure ...
3
votes
1
answer
263
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 ...
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 ...
1
vote
1
answer
143
views
Inventory system codebase
I'm here looking for a review over my current code-base.
Please:
Ignore using namespace std; this is for educational purposes mostly so the usage of using namespace std; does not matter for this ...
8
votes
3
answers
2k
views
Java TreeMap.floorKey() equivalent for std::map
I wanted something equivalent to this Java program:
...
5
votes
0
answers
330
views
Rabin-Karp algorithm implementation
This code uses the Rabin-Karp algorithm to compare two text files. It takes a few minutes when both files contain around 1000 words. How can it be improved?
...
4
votes
1
answer
654
views
Enhancing search using Fuzzy Logic in NodeJS
Brief Description:
In my NodeJS Application, I have a model called User.
User.js
...
3
votes
0
answers
319
views
reverse recursive search on an object with javascript - like tree search
I implemented a tree search with JavaScript.
It has below basic rules.
It will search over an array of objects which has recursive(like fractal)
If it found a according data in a leaf(the final ...
4
votes
1
answer
162
views
Preperiodic, periodic or aperiodic binary string
This is extension of the rep-string task from Rosette code. I do not only want to check if the input string is the shortest periodic string (rep-string) or not, but also check if it is preperiodic.
...
4
votes
1
answer
75
views
Python log entry search utility
I wrote a small utility for searching our web app log files for certain strings. The idea is that if the search string is found somewhere in the entry, the entire entry should be printed.
The ...
4
votes
1
answer
420
views
Filter for CANbus frames
The actual data types here are probably not relevant to post an answer. I use Qt types here, but the question should apply for other structured types as well.
I ...
4
votes
1
answer
597
views
Knuth-Morris-Pratt algorithm in C++
First of all, I know there is huge amount of information about KMP on the internet but many examples are just the code without any explanation. So I've decided to implement it on my own.
Secondly, I ...
2
votes
1
answer
126
views
Primitive full-text search on some properties of an object
I am not a JS/TS Guru, so i wanted to ask if one could write this better.
I needed a very primitive Full-Text-Search of some properties of an Object. What do you think?
...
0
votes
1
answer
81
views
Combinational string search using Java
I wrote a program that receives 2 strings (Input and Search) in the Search string. The sign '+' indicates that if the substring before the '+' exists in the Input string. (The search string cannot ...
4
votes
0
answers
70
views
Array Search Algorithm
Recently, I've been experimenting with an array searching algorithm that I'm not sure I've seen anywhere (minor references here).
I'm still not fully-learned on how to state the efficiency of what I'...
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 ...
2
votes
0
answers
472
views
String search function in typescript/angular
I'm trying to return a list of objects called orders based on a string search that the user enters. orders has a ...
3
votes
2
answers
105
views
Listing the playlists on which each song appears
I created a way to export my Google Play playlists to a text file and also a way to export all of my songs in Google Play to a text file. Now I have both the song list (in an array format) and ...
1
vote
2
answers
628
views
Calculating the minimum and maximum of a byte array [closed]
I've been working with binary files with this last assignment and part of it was to determine the maximum and minimum byte. Initially this was 2 functions but a bonus portion was to make them into 1 ...
2
votes
1
answer
73
views
Locate substrings within a file
Here, I am reading in a newline delimited file that can be millions of repeating lines that looks like this:
...
1
vote
1
answer
87
views
PHP code for search page
Want to show you part of code that I wrote to process search request. User commit search by articles (codes) of products. The goal is to allow user write his search request to textarea element in any ...
4
votes
0
answers
153
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 ...
5
votes
2
answers
126
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.
...
4
votes
2
answers
1k
views
Go grep command clone
I am trying to make a simple clone of the command line utility grep. I'm working on it just for fun and to practice Go. The thing is, I am trying to make it in a way that if several files are given at ...
2
votes
1
answer
294
views
Scheme: FSM substring search
I have been working on a function that return a FSM that searches a specific word based on the argument of the constructor. The idea was to use those routines as means to learn about regular ...
4
votes
1
answer
62
views
Search indexing of Battle Mech Loadouts
Background
I am since a long time ago developing a JavaFX application for creating and analysing 'Mech loadouts for Mechwarrior Online.
I previously had a very crude search function based on a ...
0
votes
1
answer
2k
views
Generic Binary Search Tree Implementation in Java
There is an implementation of Binary Search Tree. This is kind of based on Set Theory that duplicates are not allowed but an attempt to adding the same node twice will replace the older node.
BSTNode ...
0
votes
1
answer
423
views
Rabin-Karp String matching
I am learning algorithms and have implemented the Rabin-Karp string search algorithm. I didn't implement a rolling HashCode, but it's judged correct by this ...
3
votes
1
answer
400
views
Search for rows in a 2D array that contain a given sequence
I have a 2d array of m * n dimension (m and n can vary from 1 to 100000). The following snippet of code checks if the sequence exists in the row and stores the index if it exists. The time taken by ...
2
votes
1
answer
1k
views
String search algorithm for finding if a long list of long strings string exists in a similarly sized haystack
My use case is that I have a list of emails and I need to find if the email is in the chain:
...
2
votes
2
answers
8k
views
Finding specific small byte arrays in large binary files
I'm trying to quickly and efficiently find every recurring position of small byte arrays (4 bytes) in large binary files (several GBs). My current method is as follows:
...
2
votes
2
answers
98
views
Check if specific pattern exists in another array and save the index
Let's say I have this pattern and a large array:
...
2
votes
0
answers
423
views
React widget to display, sort and search remote data
I've created a React widget that pulls data on crypto-token pairs from a remote API and makes that data sortable by headers and searchable.
You can view a demo of it here.
Is this a maintainable way ...
6
votes
1
answer
964
views
Personal School Course Scheduler
A good friend of mine had the challenge of trying to build a schedule using all available times and classes through a spreadsheet... by hand. He asked me if I could build a program to generate valid ...
4
votes
1
answer
577
views
A-Star Search with 3D Universe
I am attempting to write up a program in Python that will find the shortest path between two nodes in 3D space. The actual domain is the EVE-Online Universe, which is composed of systems connected by ...
3
votes
3
answers
3k
views
Insertion of a node in M-way search tree
I am currently studying data structures and i am looking to see if my implementation of the insertion method in an M-way search tree is good and i am looking forward to improving my coding approach.
...
6
votes
2
answers
2k
views
Find the second largest number in an array with at most n + log2 n - 2 comparisons
This exercise is from Roughgarden's (excellent) course on algorithms on Coursera:
You are given as input an unsorted array of n distinct numbers, where
n is a power of 2. Give an algorithm that ...
3
votes
1
answer
74
views
Finding an index in an array of objects with 3 possible outcomes
currentUserPosts will have a post object with an id that either matches a tempId, an ...
2
votes
0
answers
2k
views
C++ implementation of Monte Carlo Tree Search with Python wrapper
Important
Prebuilt Python Extensions built for Python 3.6
Includes Python f-strings (3.6+)
Complementary GitHub link
https://github.com/thejhonnyguy/CPyMCTS
Notable: Previous attempt with stock ...
-5
votes
2
answers
3k
views
Searching with multiple filters [closed]
I was looking for optimizing a search method for an assignment where I had to search a file for employees, I should be able to search by having any of the four filters or even none; I've imagined it ...
6
votes
2
answers
3k
views
DFS in a binary tree
Problem statement: Perform a depth first traversal on a BST and print the elements traversed.
...
2
votes
4
answers
25k
views
Searching for a specific object in an ArrayList [closed]
Is this an efficient way to search for a specific object in an ArrayList?
Product is the superclasS. Mobo, CPU, RAM, GPU... are the subclasses.
ArrayList(called stock) stores Product objects. I ...
3
votes
1
answer
547
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 ...
4
votes
1
answer
186
views
Filling a string at minimal cost
I'm solving the following problem. Here is the problem statement:
You are given a string with wildcards, e.g. X***Y*Z. Your goal is to print an input string ...
12
votes
5
answers
2k
views
Find all words that satisfy unknown letters (Hangman)
I have been working on a function which might be used to solve a word game like Hangman or "Wheel of Fortune".
Basically, I wish to search from a very large ...
1
vote
1
answer
891
views
Searching for column-indices of a multi-dimensional array that match multiple conditions (one condition per row)
I have written a script that I believe works and covers all edge-cases. I am curious about ways to improve upon speed. While the given example below covers a multi-dimensional array of ...