Questions tagged [search]
This tag is for questions about search algorithms, tools, and technologies.
392 questions
2
votes
1
answer
183
views
Searching in Multidimensional Array
I was wondering about the Array built in methods in java 8. As there is no specific method other than Arrays.binarySearch. So for multidimensional array I wrote ...
2
votes
2
answers
291
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 ...
3
votes
1
answer
68
views
Brute-force electronic component selection space search
Yesterday I hacked up a simple component selection program. An example is shown at the bottom for the application, though this can be used generally for a lot of different simple circuits I come ...
1
vote
1
answer
1k
views
Performance: Use plain for loops to look for (existence of) string in string array?
I timed a few ways to look for a string in a string array (with 82 elements in the example) in a case sensitive manner plus ignoring case.
I am kind of suprised, that the plain for loops are faster ...
3
votes
1
answer
836
views
Elegant Method for Sleeping with Selenium Webscraper
My goal is to scrape the no. 1 suggestion of the suggestion list on https://finance.yahoo.com for any entry. If there is no suggestion the code should write ...
4
votes
2
answers
105
views
Search engine that looks through files
For my programming class, at the start of the semester before we learned about object oriented coding, I was supposed to make a small program that searches through a bunch of files, being graded on ...
2
votes
2
answers
199
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 ...
2
votes
1
answer
70
views
Is this breadth-first search correct?
I wrote a program that is supposed to be a breadth-first search algorithm, but I'm very new to search algorithm so I don't know if my method is very effective or if there is a simpler way to do this. ...
7
votes
1
answer
282
views
Boyer Moore Horspool Search Algorithm in Go
I am practicing Go and try to implement Boyer Moore Horspool Algorithm in Go, It returns all ocurrance of a "phrase" in a given text. This code is working, but I would be pleased to have any feedback ...
3
votes
3
answers
77
views
Find a String in an Array
This program is used to get names and numbers of N person, print out the numbers of a person. Please help me improve this code.
Additional Question:
To avoid a very long name that exceeds char's ...
1
vote
1
answer
105
views
Check if is it possible to get to a point that is presented by a number [closed]
Problem description from an Iranian online course, translated with the help of Google Translate:
Tired of coding, Mehdi has gone on to his childhood games. But because he doesn't know who to play ...
4
votes
1
answer
119
views
Comparing game tree search AI algorithms in Java
(The entire project lives here.)
I have a program that benchmarks three game tree search algorithms:
Minimax,
Alpha-beta pruning,
Alpha-beta pruning with move ordering.
So here is my code:
...
9
votes
4
answers
251
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
1
answer
74
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
342
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
286
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
155
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
343
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
698
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
328
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
184
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
76
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
492
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
627
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
183
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
83
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
498
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
126
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
695
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
77
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
88
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
168
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
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.
...
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
313
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
63
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
425
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
407
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
103
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
428
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
1k
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
594
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 ...