This tag is for questions about search algorithms, tools, and technologies.
2
votes
1answer
57 views
Typeahead Talent Buddy
Problem is Talent Buddy.
Your task is to
write a function that prints to the standard output (stdout) for each query the user name that matches the query
if there are multiple user names ...
1
vote
1answer
33 views
Search a file system for files that match a given pattern
My concerns with this code:
Is there a more efficient way to find files by pattern in Python?
Does os.walk() work in Windows?
Is this code pythonic?
Should ...
5
votes
2answers
42 views
Finding the best matching block/patch in Python
I wish to locate the closest matching NxN block within a WxW window centred at location (x,y) of a larger 2D array. The code below works fine but is very slow for my needs as I need to run this ...
5
votes
4answers
156 views
Faster method to find data using search word?
I need to search through a string array to find every occurrence of "Parameters Table", and between each "Parameters Table" and the next, get another string from a specified index (that remains ...
7
votes
2answers
359 views
7
votes
4answers
319 views
File text searcher
I have a working version of a logfile searcher that targets a specific directory by extension type, and searches the files for certain words.
I'm wondering if my method is the most efficient ...
4
votes
1answer
50 views
“Good” Blob search
I written this code to search 'blob' items (text files) on the basis of their content. For example, if I search for "Good", then the names of files that contain "Good" or "good" should appear in the ...
5
votes
2answers
124 views
Z-Algorithm for pattern matching in strings
I was trying to refactor the following Python code (keeping the same time-complexity) which is an implementation of Z-Algorithm for pattern matching in strings.
...
0
votes
2answers
67 views
How to search for a word in a sorted text file efficiently?
I want to write my own program to search for a word in a sorted text file. In the text file each word is in one line. I want to write this myself because I did not find any simple program (without ...
8
votes
1answer
85 views
Speed up my search
I have a django app with search powered by haystack. The general search goes very quickly, but I need to filter the results by their model type. It works but is very slow. I've never really worked ...
1
vote
1answer
35 views
Correct use of Joins & Wheres
I have 3 tables, 1 where voters information is stored, 2 where their address is stored and 3 where voter id's are matched with address id's. I thought this approach was best as several voters can ...
6
votes
3answers
82 views
12
votes
2answers
121 views
Hmm, a thoughtful library
I've been writing far too many routines in JavaScript that get a record from a an object or array based off a matching property, much like jQuery does with DOM elements. Since all the good names are ...
1
vote
1answer
62 views
Multiple search filter like the one in freshdesk in rails
I have requirement to apply multiple filters on database. So I am doing this now. I will have multiple conditions in the front end where the user can select the conditions he wants to filter with and ...
16
votes
10answers
2k views
Find all the missing number(s)
Recently I've attended an interview, where I faced the below question:
Question: "There is an sorted array. You need to find all the missing numbers. Write the complete code, without using any ...
1
vote
1answer
52 views
Search a value across 2 array
I want to find the corresponding hash in an array from a string that contains a criterion defined in a hash of the array.
I do something like that :
...
1
vote
2answers
57 views
Text file searching using SQL
I have the need to search a directory containing 1000+ files on remote servers where I only have access to SQL Server Management Studio and Explorer. I have written the below SQL statement which does ...
6
votes
2answers
83 views
Searching for files in a specified directory
I am currently writing a program that allows me to search for files in a user-specified directory. My current code is as follows:
...
1
vote
0answers
30 views
Binary search with heurisitcs or something else
Currently I'm using a binary search algorithm to search an index of a tree that represents an XML file.
Can I use heuristics to improve the search? What can I do to improve this search function?
...
10
votes
4answers
495 views
Find byte[] in byte[] with Java
I made a search method because I want to use binary data like PNG files. The point of this is to be able to find strings like IEND in a PNG file. I think it works ...
2
votes
0answers
68 views
The most efficient algorithm for finding treeview's node by string
I have a string variable that holds text loaded from database.
When program loads, I should find the node in treeview control with matching label text and select it.
I have found several solutions ...
5
votes
1answer
106 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 ...
2
votes
1answer
152 views
Search filter list using jQuery
I looked at a search filter code code and edited it to catered to my functional needs. I understood most of the JavaScript except the extend method bit. Can someone explain that? Also, is this the ...
6
votes
1answer
62 views
indexOf() and Boyer Moore methods
I have a method I created which is a custom indexOf(). This code seems ugly to me so I was wondering if anyone could recommend a cleaner and perhaps faster ...
8
votes
5answers
812 views
Efficient pathfinding without heuristics?
Part of my program is a variable-sized set of Star Systems randomly linked by Warp Points. I have an A* algorithm working rather well in the grid, but the random warp point links mean that even though ...
8
votes
6answers
4k views
Fast way of searching for a string in a text file
I have written this code to search for a string in a .txt file. Is it possible to optimize the code so that it searches for the string in fastest manner possible? ...
5
votes
1answer
75 views
My attempt at a weighted search in JavaScript
I tried to make a weighted search function in JavaScript. I've been improving my JS lately but still not sure about some best practices, wondering if there's any improvements I could make, or if I've ...
6
votes
3answers
130 views
How to extract elements from multiple sorted list efficiently?
Problem Statement:-
I was ask this interview question recently.. I was able to come up with the below code only which runs in O(k log n)-
Given k <= n sorted arrays each of size n, there exists ...
9
votes
2answers
184 views
Efficiently find an element in multiple sorted lists
I have k sorted Lists, each of size n. Currently I have hard coded 5 sorted Lists each of size 3 but in general that is configurable.
I would like to search for single element in each of the k Lists ...
6
votes
1answer
175 views
AngularJs and Google Bot experiment
I have learned the question of solving Angular app optimization for search engines, and was frustrated that the most recommended option is prerendering html.
After some time spent, I suggested to ...
8
votes
3answers
415 views
Scrabble algorithm review and performance suggestions
After finishing Project Euler 24, I decided to make a scrabble type of application using /usr/lib/dict as my dictionary what I cat that into a word file. It does take a few seconds, and the dictionary ...
3
votes
2answers
68 views
Searching and comparing a record
I am still a beginner in C++ and I am always curious about good/best coding methods.
Let's say I have a program which allows a users to edit the salary of a employee.
The system will prompt the ...
7
votes
2answers
3k views
A* search algorithm
A* search algorithm. Looking for reviews on optimization, accuracy and best practices.
...
6
votes
3answers
100 views
4
votes
2answers
133 views
Simple fuzzy text search algorithm
Basically, this code takes a keyword and an array of strings, then sorts them based on two things: the number of characters shared with the key, and the distance between them.(As a side note, would ...
28
votes
11answers
3k views
Searching in an array in less than O(n) time
I have an array where each element is either one less or one greater than the preceding element \$\{x_i = x_{i-1} \pm 1\}\$. I wish to find an element in it in less than \$O(n)\$ time. I've ...
3
votes
1answer
109 views
How to improve this session cache to search faster
I have this code which will store user session credentials:
...
2
votes
3answers
164 views
Improving speed of word search algorithm
I've been working on this word search algorithm and had some issues about its speed. It kinda looks like it takes a little too much time.
If anyone could offer suggestions on making this better and ...
2
votes
1answer
188 views
Grid walk problem
CodeEval's "Grid Walk" problem is as follows:
There is a monkey which can walk around on a planar grid. The monkey can move one space at a time left, right, up or down. That is, from (x, y) the ...
6
votes
1answer
180 views
Is this implementation of binary search correct?
Is this implementation of binary search correct? Any special or edge cases that I missed out? Maybe it should be optimized for elements that are less than the first element of the array or greater ...
1
vote
0answers
64 views
How to increase concision and performance in a function to retrieve sentences where keywords match?
I'm building a text search system for a web application in PHP. I wrote this function that gets the sentences of the text which contains the keywords used by the user and also highlight them (well, ...
0
votes
1answer
26 views
Highlight a pattern found
I made a small web application with a search box. I wanted to highlight the words found in the search.
...
1
vote
1answer
143 views
Wildcard search in C version 2
A few days ago, I posted my version of a wildcard search algorithm, which you can see here: Wildcard search in C
Today I'm showing version 2. I didn't want to make it in the same post because the ...
3
votes
4answers
276 views
Wildcard search in C
In the effort to improve my C knowledge, I tried creating a wildcard search function:
...
3
votes
5answers
2k views
Writing out names of files on local C drive to a text document
This program writes out all the files in the current directory level to a text file, outputs an array of sub-directories at the current level, then repeats this process until there are no more ...
1
vote
3answers
3k views
0
votes
2answers
48 views
Please help me modularize this class
The code works but I want to split it into functions and make it more reusable. The way it is now, the code is not reusable. I want the parts which replaces the query string and the part that ...
2
votes
1answer
135 views
Use search query to find and modify files in directory
I've made a program that goes through your download directory (or any other directory; you just have to change the path) and finds the files that matches your query then asks you to rename or remove ...
3
votes
1answer
1k views
Recursive find function in JavaScript / jQuery
I wrote the following code as a way of plucking data from a n-depth JavaScript object.
It works a charm and even appends the parents of the the found item.
I was just wondering if you guys had any ...
1
vote
0answers
38 views
String Matching
I recently came across a lecture on DFA. I tried to use it to determine whether a given 'search string' is found in the 'input string'. Please tell me if there is a better way
...