Skip to main content
21 votes

Search a big (13 GB) Outlook PST file

I would assume that this ...
Heslacher's user avatar
  • 50.4k
17 votes

Search a big (13 GB) Outlook PST file

COM interop is in itself a performance hit, but even when accessing it through COM (e.g. in VBA), the Outlook type library / object model is notoriously, painfully slow. If performance is a ...
Mathieu Guindon's user avatar
17 votes

C++ implementation of depth-first search

What further improvements can I make to this code? The code is rather bad - the site you read it from tends to have lots of bad/amateur articles. The graph class: ...
ALX23z's user avatar
  • 2,358
14 votes
Accepted

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

Headers and namespaces The function is missing a definition of map. This is probably what you want: ...
Toby Speight's user avatar
  • 77.3k
13 votes

Fastest string search algorithm invented by me. It is called ""Choudhary String Search Algorithm""

Maybe your algorithm is really fast, but this site isn't about algorithm review, it's about code review. And a "fastest string search algorithm" should come in a software package of an ...
Ralf Kleberhoff's user avatar
12 votes
Accepted

Filtering a list for certain strings

I took the liberty of rewriting most of this from scratch for a few reasons. First, this very difficult to actually test. All your embedded if statements... oh my! Second it's also difficult to add ...
enderland's user avatar
  • 1,726
12 votes
Accepted

Searching for a specific object in an ArrayList

Your code is very wet (the opposite of DRY). It repeats a lot. Let's start with what you're trying to achieve: You have an ArrayList of ...
Dan's user avatar
  • 3,748
12 votes

C++ implementation of depth-first search

Disagreement I have to disagree with @ALX23z blanket statement that using std::map is bad idea. There is a lot more to it than that (if the graph was sparse the map ...
Loki Astari's user avatar
  • 95.4k
11 votes

Read file with over 300k words and filter through appropriate filter to return list of matching words

First off I'd change how you are making char1filter. Here's what I'd do differently: Remove the is True as it's implied. Change ...
Peilonrayz's user avatar
  • 43.4k
10 votes

Composing and executing a customer search

Not sure if you know how dangerous omitting braces for if statements can be. Do you know what happens here : ...
Heslacher's user avatar
  • 50.4k
10 votes

C++ implementation of depth-first search

I've assumed here the OP is performing DFS on undirected graphs - if not only my second point is valid. There are several other answers here suggesting better coding practices and more efficient ...
Chaos's user avatar
  • 201
9 votes
Accepted

Binary search function in C#

This code is wrong in a great many ways. public int BinarySearchIterative(int[]inputArray, int Key) { The name describes how the code is implemented, not what it ...
Eric Lippert's user avatar
  • 14.9k
9 votes
Accepted

Search in a JSON structure after a key

Your function name is not very meaningful in that; a) there is nothing to say values returned in the array will be objects (since you are just grabbing whatever data is stored for the key), and b) ...
Mike Brant's user avatar
  • 9,638
9 votes
Accepted

Find and rename all png files

First of all you should rename your function, it doesn't perform just a search then DirSearch() is not appropriate. What about, for example, ...
Adriano Repetti's user avatar
9 votes

Find all words that satisfy unknown letters (Hangman)

The solution would indeed be much simpler using regular expressions. The trick is to build the regular expression dynamically, using a negated character class like ...
200_success's user avatar
9 votes

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

Your code is obviously wrong: template <typename key,typename value> This line suggests that the code works for arbitrary maps, yet you require an ...
Roland Illig's user avatar
  • 21.3k
8 votes

Searching for a specific object in an ArrayList

there is a redundant semi-colon ';' at the end of every if and at the end of the loop (basically after closing curly braces) code to the inteface: the method should accept an argument of ...
Sharon Ben Asher's user avatar
8 votes
Accepted

DFS in a binary tree

This code is pretty much the most efficient it can be, so I will add some pointers on the coding style and convention. Instead of calling your Binary Search Tree class a BST, define it as ...
Anshul Goyal's user avatar
7 votes

Product search script Object Oriented PHP

Security: SQl Injection You use prepared statements, which is great. But you still put variables directly into SQL queries, which makes you vulnerable to SQL injection via ...
tim's user avatar
  • 25.1k
7 votes
Accepted

Read file with over 300k words and filter through appropriate filter to return list of matching words

In addition to the suggestions made by Joe Wallis, here’s one that will help performance: Don’t store the entire file in a tuple. This requires Python to store the entire file in memory, which is ...
alexwlchan's user avatar
  • 8,565
7 votes
Accepted

Detect if string contains more than 1 period

Optimize for maintainability first Is the complexity of your function really needed? The functionality can be implemented in one line using only standard-library algorithms. ...
5gon12eder's user avatar
  • 4,280
7 votes
Accepted

Find a best fuzzy match for a string

You should take advantage of the key argument to max(): The key argument specifies a one-argument ordering function like that ...
200_success's user avatar
7 votes
Accepted

Sum of 2 numbers in an array

Since there's no real review to do and we're apparently just posting solutions... here's a simple O(n) time O(1) space one: ...
superb rain's user avatar
  • 3,991
7 votes
Accepted

Copy file with text replacement

std::getline and std::string are in the <string> header, so we need to include that. ...
user673679's user avatar
  • 11.8k
6 votes

A* search in MATLAB

You say getNeighboursByIndx takes 50% of the total time. That means that you should try to reduce either: The number of calls to ...
Stewie Griffin's user avatar
6 votes
Accepted

Checking if a line in a file contains user.Handle and '-r'+any single digit number

If I see it correctly, you could already simplify your code by saying ...
peter's user avatar
  • 176
6 votes
Accepted

Find all strings in list which have keywords in it from another list

Your general coding style is very readable. You stick to PEP8 and your function and the variables are named reasonably. You could optimize your code by using the built-in functions ...
Richard Neumann's user avatar
6 votes

Functionally find the index of the minimum value in an array

I think there's no need to use the match keyword here because you're not actually doing any pattern matching, only shadowing the name ...
TheQuickBrownFox's user avatar
6 votes

Go grep command clone

The thing is, even so, standard grep still gets results faster by an amount of 60 % less processing time For more information on what makes GNU grep fast, read this by the original author. Here is ...
esote's user avatar
  • 3,770
6 votes
Accepted

Filter for CANbus frames

Cleaner and clearer it can certainly be: your function is called isFrameMatchedByFilter but returns true if there is no filter in the filter list: does that mean ...
papagaga's user avatar
  • 5,757

Only top scored, non community-wiki answers of a minimum length are eligible