Questions tagged [search]
This tag is for questions about search algorithms, tools, and technologies.
382
questions
10
votes
1
answer
481
views
Bash command helper in C
Previously, I had written this program in C++ and asked about it here on Code Review. After spending some time with C++, I desired to become more familiar with its namesake. This is my first C program....
-3
votes
1
answer
3k
views
Mapping phone numbers to names [closed]
Problem description:
You are given a phone book that consists of your friend's names and
their phone number. After that you will be given your friend's name
as query. For each query, print the ...
4
votes
3
answers
10k
views
Replacing multiple search strings simultaneously
A utility method StringUtils.replace to replace multiple search strings simultaneously.
I'm looking for a review of any and all aspects, but especially:
Is there's ...
5
votes
1
answer
855
views
Search file for keyword program
Just looking for some advice and I know using std namespace is bad but I didnt have the time to do all the using stuff. I want help on what here is good and what is bad practice :).
...
12
votes
1
answer
162
views
To read a book thou should have it bought, to buy a book thou should have it found! (Search Abstraction)
I started a hobby project to find the books that I read (paperbacks) so that I can keep track of them (reading start date, finish date, number of pages, etc..)
The first challenge was to find the ...
14
votes
2
answers
2k
views
A* search in MATLAB
I have implemented A* search in MATLAB, but I am looking for ways to increase the speed and optimize it. I have tried using a priority queue but I found it doesn't work that well, so I am using a ...
10
votes
4
answers
301
views
Let's play Find that File
Isn't it annoying when you can't find a file you recently created? Especially when you either have a very disorganized drive or a directory with lots of files.
Even if you don't care, isn't it nice ...
10
votes
1
answer
1k
views
Scanning multiple huge files in Python
I'm trying to implement an algorithm able to search for multiple keys through ten huge files in Python (16 million of rows each one). I've got a sorted file with 62 million of keys, and I'm trying to ...
0
votes
2
answers
256
views
Command line google searching
I have a bash script that is meant to start a google search from the command line. I am also looking to implement a way of getting source code for the search page possibly through a subscript. This is ...
5
votes
1
answer
102
views
SQLite search disregarding spaces and Pinyin tones
I have a column where, pretty much, each entry has numbers (specifically #1-4) and spaces (' '). I wanted to make a query that could avoid having to know these numbers and spaces.
...
1
vote
2
answers
849
views
Searching for an object in a list returning boolean and referencing variable
My method searches through an list of accounts which have the property "Name".
...
11
votes
2
answers
172
views
"Vc" as in Vancouver, or Valencia?
It is common to shorten city names when writing, or at least in Sweden.
"Göteborg" (Gothenburg) is often referred to as "Gbg"
"Uddevalla" is commonly written as "Ua"
"Trollhättan" is often written as ...
3
votes
1
answer
319
views
Finding nearest float values corresponding to a data point (of three variables) in a table with multiple columns using C++
I have a data file which contains floating point data arranged in 4 columns. Each row represent a specific data point. The first column(X) is made up of 100 different values but the values are ...
6
votes
1
answer
125
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", ...
2
votes
3
answers
328
views
Finding Egyptian fractions with A* search
I've written an A* search to find the optimal solution to the equation
$$ \dfrac{4}{n} = \dfrac{1}{x} + \dfrac{1}{y} + \dfrac{1}{z} $$
with \$n, x, y, z\$ positive integers, and \$n\$ given; the ...
1
vote
1
answer
103
views
Searching and replacing text
Simple Playlist Modifier
This program is a search and replace program for text based files. The main goal of the program is to replace directory paths to music files.
The idea is to have the program ...
1
vote
1
answer
51
views
Implementing BST in javascript
Is this an efficient and clean implementation?
...
1
vote
1
answer
174
views
Array search algorithms: performance comparison
I'm making a program that compares multi-key sequential search and Interpolation search in a sorted array by the number of array accesses for my assignment.
...
9
votes
1
answer
404
views
Trinary Search Tree
I'm probably not the first to think this up, but here we go. An trinary search tree is a generalization of a binary search tree in the sense that instead of a comparison function returning true or ...
10
votes
1
answer
1k
views
Generic domain independent Monte Carlo Tree Search methods library
I've written this small generic library for the purpose of my Bachelor's thesis. It's fully functional and unit tested and I want to get as many opinions as possible regarding overall code quality (...
2
votes
2
answers
2k
views
Breadth-First Search heuristics to find solution to Water Jug Challenge
I started learning AI recently. In AI, searches should be avoided and everything in AI is a search problem.
One of the easiest problem where we could use general AI search techniques is the water jug ...
4
votes
2
answers
243
views
Calculating the number of steps it takes to get from point S to F
I have following Java class called TheNewMario. It reads a String path and iterates through the path from ...
7
votes
1
answer
586
views
Implementing a (small) full-text search in Ruby
I'm trying to implement a small full-text search in Ruby. I feel like I've laid down the foundation but I've encountered a blocker that has gotten me thinking that something with the design is ...
3
votes
1
answer
837
views
Breadth-first tree cutting
I have a working solution for 'Cut the tree' problem but it is not fast enough.
Problem Statement:
Atul is into graph theory, and he is learning about trees nowadays. He observed that the ...
4
votes
2
answers
226
views
Searching within multiple objects of the bucket
I have millions of files in the Google cloud storage's bucket. I want to search within files with a .index extension and retrieve the contents.
This is currently what I am doing, but the time ...
0
votes
1
answer
2k
views
Laravel Controller including sort and search
I am using this code on my own personal website (my personal administration site) so it doesn't need any security and so on. I am not into learning everything about that yet, and although I do know a ...
3
votes
1
answer
263
views
Small BM25+ implementation for probibalistic result ranking
I came up with this small implementation of an Okapi BM25+ ranker using Ruby. I cooked it up in a very short time so it's very simple but I'm trying to think whether there's a better way to write it. ...
2
votes
1
answer
131
views
Pattern search in a text
Is this a practical algorithm for pattern matching in a text? Assume text can be very large, is there anything I can do to speed up the performance?
...
6
votes
2
answers
1k
views
Contact search application
Create a C++ program which will act like contact search app in mobile.
For example, if the following contacts are saved in contact list:
Massi
Pradip
Prasad
Praveed
Raju
...
1
vote
1
answer
277
views
Search module in JavaScript
I implemented search module, but I'm a novice in programming and I'm not sure about public and private functions that I coded. Did I do it right?
...
2
votes
1
answer
757
views
Graph, and a search that visits each edge exactly once in each direction
My assignment was to write a method that is capable of visiting each edge in a graph in each direction exactly once.
With it, I included a basic Graph class to test it with.
What I'd like a review ...
3
votes
1
answer
200
views
Substring searching with Knuth–Morris–Pratt
My program uses the Knuth–Morris–Pratt algorithm to search for a particular substring in a .txt file and then store it in a binary search tree.
Note that ...
10
votes
2
answers
584
views
Minimum sub-array challenge
Below is my solution to finding the minimum product sub-interval. It passed 8/12 or so test cases, but the other test cases timed out if they hadn't finished within 2 seconds. When I compile this code ...
4
votes
4
answers
6k
views
Hackerrank's Sherlock and Array
Challenge can be found here
Problem Statement
Watson gives Sherlock an array A of length N. Then he
asks him to determine if there exists an element in the array such
that the sum of the ...
2
votes
1
answer
905
views
Laravel 4 search function
I am using this code in my controller and would like to know if this is good code to use or if I can write it better, or more compact, and so on. I am just trying to learn from this. It does work, so ...
5
votes
2
answers
105
views
Wildcard string search with capture
My goal was to create a function as performant as possible with results being:
True/False as to whether wild matches str.
...
8
votes
3
answers
834
views
Search string for a substring - indexOf
I am trying to write my own implementation of indexOf for learning purposes. I have an implementation of as follows. I'm sure a more efficient and shorter ...
5
votes
1
answer
168
views
First attempt at weighted search
My concern is speed, since this may be used in an e-commerce website I want it to be as quick as possible. Where can I improve?
...
5
votes
2
answers
486
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 ...
3
votes
1
answer
125
views
Yellow Pages Search
I've written code in Free Pascal based on a contest problem (The contest insists that I have to write with Pascal). It works like charm, but I think it still need some improvements, from memory usage ...
2
votes
3
answers
609
views
Searching a string of consecutive characters in a binary bar code
I am writing a program that will take a binary bar code and convert it to a zip-code. I need to validate the bar code. A valid binary bar code contains no more and no less than two 1s in any position ...
4
votes
2
answers
101
views
Search key in a rotated sorted array without repetition of elements
Is there any improvement possible in this implementation?
...
6
votes
2
answers
8k
views
Find largest block in matrix
(Largest block)
Given a square matrix with the elements 0 or 1, write a program to find a maximum square submatrix whose elements are all 1s. Your program should prompt the user to enter the number of ...
3
votes
2
answers
62
views
Search utility that searches through source code files
I'm working on a search utility that searches through source files. It's only the beginning of the project. It lacks a lot of features, but a backbone of the project works and it would be great if you ...
12
votes
3
answers
13k
views
Suffix tree implementation in Java
I was trying to solve the problem where given a larger string and an array/list of smaller string, we need to make the determination whether the larger string contains each of the smaller strings. I ...
5
votes
2
answers
9k
views
HackerRank Grid Search challenge
I’ve written an answer for The Grid Search challenge on HackerRank.
Please let me know of any improvements that can be made to my implementation (specifically if there's any way to make the algorithm ...
3
votes
1
answer
423
views
Find minimum element in a rotated array
Here's an implementation of finding the minimum element in a rotated array using binary search (one that is sorted in ascending order, and all elements are distinct).
Please let me know of any ...
3
votes
1
answer
66
views
Song search app with dynamic tables
I decided to make a Ruby app to search for songs, which uses the tinysong API. Things got really cryptic and weird in the view. I managed to get dynamic tables that adjust to data length, but I feel ...
2
votes
2
answers
38k
views
Find index of an object with a specific value stored in an array
I am using the following code in order to retrieve the index for an object stored in a JavaScript array.
Scripts works fine, but I would like your opinion regarding performance.
Also would like to ...
5
votes
3
answers
863
views
Complex search program
I am working on a fairly complex (at least it feels complex to me at the moment) search program and am looking to possibly increase the performance. Everything works exactly how I want it to, but I'm ...