Optimization is the act of improving a method or design. In programming, 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)

1
vote
2answers
48 views

Project Euler 38: Pandigital Multiples

I just solved Project Euler 38 and was wondering if you guys could provide some suggestions on how to speed it up. I've tried adding extra conditions but they increase the time. Any ideas on how to ...
2
votes
1answer
20 views

Slow calculation of trigonometric sine function

Background Creating a client-side pie chart in XSLT 1.0, without extensions or external dependencies (i.e., cannot use FXSLT, EXSLT, JavaScript, etc.). Problem The code is slow; at least fifteen ...
1
vote
2answers
31 views

Calculating the Nth number in the supertable of two numbers

Below is the problem: Little Timmy is exceptionally good at math tables, so his teacher decided to make things a bit more interesting. His teacher gave him two numbers, A and B, and told him to ...
2
votes
1answer
149 views

Stored Procedure calculating employee earnings

I have following stored procedure in a C# win forms application which calculates employee earnings based on attendance as follows. Note that a shift is 12 hours and employees mark attendance for in ...
3
votes
1answer
61 views

Optimization/speed up of reduction function

I'm working on an implementation of Rainbow tables as part of a project. I understand the main principles behind it had have a working solution. Unfortunately the reduction function portion of my ...
7
votes
2answers
86 views

Algorithm to calculate semi perfect integers, lack of effeciency

I'm working on an algorithm to calculate weird numbers, and to do so there are several properties that needs to be calculated, one of them being, if it is NOT a semi-perfect/pseudoperfect number. My ...
3
votes
0answers
381 views

Optimizing this maze-solver

I've written C# code for solving a maze problem. It works, but I want to optimize it so that it could give me all paths. To solve the maze, I walk on the zeros and assumed that the final is reaching ...
12
votes
4answers
388 views

Finding person with most medals in Olympics database

I have an Olympics database from each Olympic year and I want to find the person that has won the most medals. The main problem is that I'm basically querying the same sub-query twice in ...
11
votes
3answers
349 views

Efficiency of this constantly running time processor for an HTML5 video control bar

I built a custom HTML5 video control bar, and for each second, it updates two readings: Time Elapsed Time Remaining in hh:mm:ss notation, like so: Because of how often this function runs, I ...
3
votes
1answer
62 views

Splitting My Code Into Classes/Functions

I'm looking for code correctedness, best practices. The player will have different spells, that can be cast on different keyboard key combinations. Right now what I have is one .as file with ...
8
votes
4answers
334 views

Moving character in Unity3D based on accelerometer input

I am building a infinite vertical platformer for mobile platforms using Unity3D. I am using the accelerometer to move the character left and right on the screen. ...
3
votes
2answers
3k views

Optimizing mass inserts into SQLite

I am trying to optimize inserts from a returned JSON which contains data from multiple tables on the remote server. My code is working, but I just want to figure out a way for it to work better. I ...
5
votes
2answers
114 views

Project Euler 34 - digit factorials

145 is a curious number, as \$1! + 4! + 5! = 1 + 24 + 120 = 145\$. Find the sum of all numbers which are equal to the sum of the factorial of their digits. Note: as \$1! = 1\$ and \$2! ...
5
votes
1answer
56 views

Remapping Heading Angle to Coordinates to Move By

I wrote the following code to take the heading of an object, and determine which direction (x,y) it needs to move to be heading forward in a 2D plane. I have ...
1
vote
1answer
66 views

Optimizing memory game

Can anyone help me optimize my code? I really don't know what to do about all the var rectangles and var colors. ...
4
votes
1answer
61 views

ListBox Update Handling

I have UserGroups for Users to be assigned to in a ListBox in HTML form. Items from listbox can be multi-selected or completely ...
3
votes
0answers
47 views

Web page based on a sample from a book

I've created a web page based on a sample from a book. It works fine, but seems to have become too complicated. ...
2
votes
2answers
3k views

Animation with 5x5 map of cubes

I am trying to learn how to animate with tkinter. The code below is an example I was able to build. It creates a small 5x5 map of cubes, then one of them randomly moves around the screen (preferably ...
4
votes
2answers
63 views

Deep pick using lodash/underscore

Use Case _.pick creates a shallow clone of an object given a predicate that identifies which keys to keep. pickDeep would ...
8
votes
1answer
140 views

Improve mixin that outputs page-specific CSS

As part of this answer, I created a mixin to generate some page-specific CSS for me. I need to style an element based on a class I assign to the html-element. I do ...
22
votes
4answers
2k views

Ultimate Tic-Tac-Toe in C

Here is my attempt at the UTTT code-challenge (in response to the the Weekend-Challenge Reboot). Here is what I would like critiqued: I tested the code a few times for bugs, but I may have missed ...
11
votes
6answers
1k views

Dynamic programming with Fibonacci

I have written the following code using a dynamic programming technique. Can I use ArrayList here? Please let me know if I can improve this code. ...
5
votes
0answers
77 views

Merging overlapping/intersecting string vectors

I am trying to merge overlapping/intersecting sets given as a list of string vectors below in R (my actual data set has thousands of such sets). The overlap/intersection is based on the ...
5
votes
3answers
253 views

Reading from an Excel sheet

I have created a class for reading data from an Excel sheet and holding on the variable. I am not sure if my code is optimized, meaning I will be reading heavily from Excel. Is there a room to ...
5
votes
2answers
70 views

Finding prime numbers in a range

Finding the prime numbers between two given integers in the minimum number of comparisons: ...
3
votes
2answers
104 views

Is there a better way to write these two nested loops in Erlang?

Since one month, I'm learning Erlang and I like it so much. Today, I wrote an algorithm to solve a problem. Some time ago, I used two nested for loops in C# to ...
8
votes
2answers
60 views

Contest code for a maze problem

I would like to ask your comments on my contest code for the following problem: We're going to have a slightly more logical puzzle today. We're going to write a program that will find a path through ...
6
votes
1answer
204 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 ...
5
votes
2answers
189 views

Retrieve and load playlists from YouTube

I have this code I am using in a private project. The following is a snippet of code I use to retrieve and load playlists from YouTube: ...
4
votes
2answers
91 views

“Sherlock and queries” challenge

I'm writing some Java code for some pretty large datasets, in a puzzle I'm trying to solve. The output is correct, but the program doesn't run within the time limit for all the test cases. I've ...
5
votes
3answers
237 views

Optimizing word counter

I took the Python class at Google code today, and this is what I made for the problem about building a word counter. Please take a look and suggest any improvements that can be done. Please do point ...
4
votes
2answers
76 views

Getting the unique factors of a number recursively

I have written the below code to get the unique factors. Please offer suggestions for better results. ...
3
votes
4answers
105 views

Returns values for a specific array and key

This code is intended to take an array and a key as inputs, and return an array of the values paired with that key. ...
3
votes
1answer
37 views

Removing of star-args [closed]

I have such functional code: ...
3
votes
1answer
115 views

Optimizing and clarifying nested list appending

I have such part in my script, how can I optimize such parts? I don't want to use many local variables. ...
3
votes
0answers
24 views

Factorial using trampolines

I've translated this Java code into Delphi code: ...
-1
votes
0answers
26 views

Optimizing TSP branch and bound algorithm in C [closed]

I implemented this Branch and Bound algorithm below but I can't get optimal results, not even with 5 points. It just works on the right child but not on the left. ...
8
votes
3answers
355 views

Finding the largest of a series of numbers being XORed

I'm working on solving a problem involving finding the largest of a series of numbers being XORed. This is the actual problem: Xorq has invented an encryption algorithm which uses bitwise XOR ...
4
votes
1answer
43 views

Website parsing optimizations: cleaner way to deal with special cases and improving data transfer between classes

I have a DiningHall class that has the 3 properties: openingTime, closingTime, and ...
-1
votes
0answers
40 views

Java GS Collections ImmutableList implementation [closed]

The following code is taken from GS Collections implementation of immutable Lists. Is it good practice to perform the above chain of construction for small lists of size <=10 ? ...
1
vote
2answers
251 views

Efficient way of code reuse for finding the largest prime factor

I was doing timing with variations of function largest_prime_factor. I was able to write a better one largest_prime_factor2. ...
1
vote
2answers
191 views

Performance with C++ algorithm

This is an algorithm I'm trying to optimize. I was trying to use openMP without any success. I know the code is long but most of it is params init. Please try to explain why I need to change any ...
1
vote
1answer
28 views

Optimization of recursive jQuery images swap function

There's this website I'm working on that needs to swap images every few seconds, like a slideshow or image fade swap in a way, except that you need to target 5 IMG tag elements. I was able to make a ...
5
votes
4answers
72 views

Optimizing nested loop in run length encoding function

I'm currently working on a tool that needs to decode, modify data, then re-encode that data using the Yaz0 format. Everything has been in a working state, but after running some code analysis on my ...
8
votes
4answers
170 views

Adding two sides of an array

The purpose of the program is to add 2 sides of an array starting from the bottom and top of both ends and to find the lowest difference at equal decrements of iteration. The program functions but ...
5
votes
1answer
62 views

Interpolate then maximize

I need to optimize $$ \max_{a',\ m'} f(a, m, e, m', a') $$ I have approximated \$f\$ with a grid \$F\$ — it has shape \$(nA, nM, nE, nM, nA)\$. Now, I want to interpolate over the last two ...
1
vote
1answer
38 views

Optimization of a Qt QByteArray conversion

I wrote a function to convert a hexadecimal string representation (like 0x00) of some binary data to the data itself. How can I improve this code? ...
6
votes
2answers
92 views

Put it in a bucket

You're running a jeans company. Your system is collecting detailed orders' data, but it's a bit archaic and it's storing the number of units ordered per size in a delimited string with 20 "fields", ...