Optimization is the act of improving a method or design. Optimization usually takes the form of improving the efficiency of an algorithm, or reducing the resources it requires (space in memory, on disk, or amount of network traffic, etc.).

learn more… | top users | synonyms (2)

0
votes
2answers
85 views

Increment a text field value

So let's take this code which increments a Javascript text field value: ...
3
votes
1answer
20 views

Grouping counts from tables by account ID

I'm working with this query to get counts from three different tables, and to group the results by account ID: ...
4
votes
1answer
83 views

Is a Number Prime?

Haven't posted here in a while, but I think I've come up with a very efficient way of finding if a number is prime, using TI-BASIC for use with TI-83/84/+/SE calculators. I am trying to optimize it ...
5
votes
2answers
129 views

Linked list implementation of a stack

I am working on a basic linked list implementation of a stack of ItemType (currently set to double but can be changed) values. The stack code will then be used in a ...
2
votes
1answer
54 views

Convert between two bases, each between 2 and 36

I'm doing some Python practice for fun and I wrote some code that converts between two bases. I'm thinking about expanding on this later, so the docstrings are pretty redundant from function to ...
3
votes
1answer
46 views

Improving efficiency of Prim's Algorithm

I have implemented Prim's Algorithm in Java. I am wondering how it can be made more efficient. Below is the class Node for vertices. ...
5
votes
2answers
202 views

Draw crosshairs on the screen - ZedGraph

Here's some part of my code is use to draw objects on the screen : Class members: ...
-2
votes
0answers
30 views

DDD - Aggregate root splitting into smaller and specialized aggregates [on hold]

I have in my application 'User' aggregate root which has a lot of properties and methods ...
4
votes
1answer
67 views

Custom marquee consumes a lot of CPU power

I've a code which applies marquee to certain elements by using the requestAnimFrame method. However, when I test my application on a lower spec PC (Intel Celeron ...
1
vote
1answer
29 views

Defining functions in Vigenere cipher

I'm trying to learn the process of defining/calling a (somewhat) complex function. I understand the main idea, and can do it on a small (simple) scale. A simple example: ...
5
votes
4answers
209 views

Character permutations - Revisited

Several hours ago I posted this question about Generating character permutations in Python. User rolfl said that my main problem was not using the right tool for the job, as Python is interpreted it ...
4
votes
1answer
34 views

Efficiency of looping though a text map to draw objects

I am making a game that uses a text map to draw obstacles and courses for the player to navigate. However, I am concerned that my method of looping through the text map to draw objects on the screen ...
4
votes
1answer
47 views

Speeding up nested for-loop analysis code

I have two matrices, the first one is mat 2000*500, the second one is 6000*500 ...
3
votes
2answers
151 views

Generating character permutations

I want to generate a 'dictionary' containing all 8 character permutations of upper-case letters such that the output file looks like: ...
9
votes
1answer
673 views

Memory-Test for Soldiers

I am solving the following problem on code chef: \$N\$ Soldiers are lined up for a memory test. They are numbered from 0 to N-1 from left to right. In the test, there are \$M\$ rounds. In each ...
12
votes
2answers
164 views

Calculating the minimum distance of a linear code

This is a solution for the problem named Codes on the kattis platform: Given a generator matrix of a linear code, calculate the minimum distance of the code. I'm looking for reviews on ...
3
votes
1answer
111 views

Find next highest number with the same digits

Question: Given any integer, efficiently find the next highest integer that uses the same digits. For example if the number is 15432, you should return ...
6
votes
5answers
278 views

Is there a more efficient way of executing multiple SQL prepared statements at once?

I'm updating more than one table at once and, as you will see, it uses a lot of similar looking code. Is there a more efficient way of doing this, perhaps some way of combining the queries? For ...
4
votes
2answers
224 views

How do I decrease compile time and execution time of following program?

How can I decrease the running time and compile time of the following code? Given three integers A, B and ...
5
votes
1answer
40 views

Formatting database like table

The goal of my program is take some headers and fields and display a nicely formatted table like this: ...
3
votes
2answers
150 views

How do I (beautifully) extract this part of code to a subclass?

I have thought a lot about this but can't come to a proper solution. Also, it's hard to google things like this. Note: The code itself is irrelevant, it's about how to do such a thing in general. I ...
4
votes
1answer
38 views

Dirty but Efficient Texture Atlas in Spritekit

I have spent quite a bit of time trying to optimize the performance of my 2D mining game. After a lot of research, experimentation, and testing, I finally found something very interesting that ...
11
votes
4answers
173 views
+50

Fastest way of removing a substring from a string

Taking a break from my C++ series, I recently reviewed the code in this question. I ended up writing my own separate derivation of the function so that I could remove all of the substrings from a ...
1
vote
1answer
23 views

Implementation of Vertex Similarity algorithm (Blondel's Similarity Measure)

I am implementing the vertex similarity algorithm in this paper. The adjacency matrices I will be dealing with, however, will be very large, on the order of 30k vertices (I provided sample matrices in ...
2
votes
1answer
57 views

Non-concurrent write creates bottleneck

I have some efficient methods that recursively creates a tree structure (NSTreeNode) of by looping recursively over a directory structure. The result is displayed ...
5
votes
3answers
420 views

Trip Advisor - Train routes

Gives advice to the user on which trains to take to reach a destination ...
6
votes
1answer
69 views

Is this a correct implementation/use of move semantics?

I'm trying to account for the fact that my program will contain calculations such as: v(t) = w ∗ v(t−1)+ c1∗r1∗( pBest − x(t −1)) + c2∗r2∗(gBest − x(t−1)) where ...
2
votes
2answers
48 views

Function that normalizes a vector of double

I have written the following function in order to normalize a container of double, so that it sums up to 1.0: ...
6
votes
2answers
55 views

Making backtracking Knight's Tours solution more efficient

This was a previous homework assignment I was required to do. While I did the assignment and turned it in for credit, I am not completely satisfied with the result I have. The rule for the assignment ...
6
votes
1answer
46 views

Passing a 1D array (single column of a Range object) to .NET to manipulate it without loops and returning it back to VBA

Background Kind of a follow up - slightly related to my other SO question. I thought that if somehow I find a way in VBA to pass a single column to .NET and convert it to a native .NET type then I ...
2
votes
1answer
40 views

CAPTCHA with images of objects

This CAPTCHA is not text but basically images of objects that the users has to identify between an array of options. My current code is kind-of slow because the query takes almost .7s to execute and ...
1
vote
1answer
63 views

Is there a beter way to check input besides a switch case?

So I am running a Switch case to check if a user has filled in all the necessary fields within a form, and if not I prompt them to do so. I was wondering if there was a better way to do this, or if a ...
5
votes
1answer
122 views

Iterative Fibonacci sequence using standard library functions

We're all aware of Fibonacci sequence calculators but they look like C-style code. I want to avoid that and take advantage of the standard library. This code is very short, so I'm focusing on ...
26
votes
9answers
6k views

Solving the Lazy Hobo Riddle

I would like help in optimizing this calculation, which is from the Lazy Hobo Riddle: There once were 4 hoboes travelling across the country. During their journey, they ran short on funds, so ...
5
votes
1answer
112 views

What are the latest Odds?

The main problem the following query is solving, is the following: Each Offer has multiple Odds (...
1
vote
2answers
74 views

Improving performance on file reading

I got a small assignment to read IP adresses and from a bunch of external text files identify which country the IP adress comes from.. I opted to use XmlReader and read the ranges from an XML file but ...
2
votes
1answer
80 views

Optimizing breadth-first-search code

I wrote code using some kind of breadth-first-search algorithm in order to find a path (any path!) from a start point to an end point. There are no weights/different distances involved from path-to ...
7
votes
1answer
67 views

Sorting algorithms with utility functions and iterators

My implementation of insertion, merge, and quick sort, with some utility testing functions. I just wanted to know how I can improve the efficiency and general cleanliness of my code. (note: I know ...
3
votes
1answer
108 views

Security flaws in smartphone application

And could you give me any security and optimization recommendations? ...
2
votes
3answers
98 views

Optimizing run time of Python solution to Project Euler Problem 34

This is a brute force solution to Project Euler Problem 34 with only 1 optimization (i.e.: caching factorials): ...
1
vote
1answer
42 views

Crawl multiple pages at once

This an update to my last question. I want to process multiple pages at once pulling URLs from tier_list in the crawl_web ...
6
votes
4answers
821 views

Karatsuba C++ implementation

I've written an algorithm for integer multiplication using the Karatsuba method in C++. This implementation is far from ideal, so any comments are welcome. ...
4
votes
2answers
234 views

Project Euler #48 in C++

This question is similar to Project Euler #48 but constraints are different: $$N < 2000000$$ Just in case the link is unavailable, here is the problem statement: We've to print $$\left( ...
5
votes
1answer
80 views

Vector comparison inside for-loop

The following code finds no-rain periods in a time series that were preceded by rain over a threshold (e.g. 10mm in 2 days [k=48]). ...
2
votes
1answer
29 views

Migrating Data in Mongo

I have the follow script to change my data within Mongo DB: ...
3
votes
2answers
179 views

Fastest way to find and replace inside a large amount of files

Currently I am looping through dependencies of objects, and I am trying to replace GUID (unity object ID's) inside the files. Right now I am using the following code, any suggestions for improvement ...
1
vote
4answers
318 views

Creating a grid in HTML from a database search

I have a little piece of code that is a little bit unoptimized and need some help with optimization in this case. The procedure is to search in a database using "Conditions/Condicao" and create a ...
1
vote
2answers
91 views

Basic search engine

I want to improve efficiency of this search engine. It works in about 10 seconds for a search depth of 1, but 4 minutes at 2 etc. I tried to give straightforward comments and variable names, any ...
1
vote
1answer
45 views

Optimization of AngularJS function to load images on the page

I have two AngularJS function in my dataContext object that receive data from a WebAPI: ...
3
votes
3answers
107 views

Speeding up storage of about 220000 values in Core Data

I use this code on the app's first run to save about 220000 values into core data. The file Navaids.txt has about 200000 and Waypoints.txt has about 20000 lines, where I get data from each line and ...