Optimization is the act of improving a method or design. In programming, optimization usually takes the form of increasing the speed of an algorithm, or reducing the resources it requires.

learn more… | top users | synonyms (2)

0
votes
1answer
32 views

Playing Card Class - is this right?

The Art and Science of Java, a course book that uses the ACM library has an exercise that reads like this. Implement a new class called Card that includes the following entries: • Named ...
1
vote
1answer
15 views

Improve file-path finding method

I am using a recursive algorithm to find all of the file-paths in a given directory: it returns a dictionary like this: {'Tkinter.py': 'C:\Python27\Lib\lib-tk\Tkinter.py', ...}. I am using this in a ...
1
vote
1answer
22 views

Improving my jQuery animation

I wrote the following fo create an animation which collapses a navigation bar, load new content for it and expands it again. Meanwhile, the rest of the page content fades out, loads and fades in ...
2
votes
2answers
69 views

Largest Palindrome efficiency

I have written an algorithm to find the largest palindrome under a given number, but I am sure my code loses efficiency by creating new arrays in every pass. I am currently learning about efficiency ...
1
vote
1answer
116 views

Which code is better? And why?

I found two ways of writing the same program (one that only uses local variables, but no methods other than the main one) and other that uses one instance variable that is used in two methods. This ...
2
votes
1answer
38 views

Is there a more optimized way for this MySql Query

with below query i'm getting the results that i want but it's quite slow taking nearly 0.2 seconds (on an i5 machine). Is there a more optimized way to get the same results. Basically this query ...
1
vote
1answer
72 views

Add checkbox with label to a form

For a WordPress login form I have written a small plugin. It adds a checkbox with a unique name to the form and if that name is not present in the login POST request it just dies. The idea is ...
2
votes
2answers
97 views

How can I improve this coin flipping code?

I am doing exercises for the Art and Science of Java textbook. I had an exercise that required me to program the simulation of flipping a coin until 3 consecutive "Heads" result appeared. I did it, ...
1
vote
2answers
74 views

How to optimize this code?

So I have this piece of code in Java(Android) to add a list of brokers to a local SQLite database as one single sql instruction. public void Add(List<Broker> brokers) { if(brokers == null ...
0
votes
1answer
41 views

Image Resize/Crop Class

I've combined some of my own functions with a function I found and I'm curious to know what others think of it. It will be used to upload and resize/crop images that are jpeg, jpg, png. <?php ...
1
vote
1answer
100 views

Guess my Number in C++

I have recently created my first game in C++: #include <iostream> #include <cstdlib> #include <ctime> using namespace std; int main() { cout<<"\tWelcome to Guess my ...
5
votes
2answers
113 views

Help refactoring my tic tac toe game

I'm very new to coding and have been diving into the skill with Python as my first language. One of the first programs I wrote for a class was this Tic Tac Toe game. I re-wrote this game using classes ...
1
vote
1answer
23 views

Eliminate for loops in numpy implementation

I have the following dataset in numpy indices | real data (X) |targets (y) | | 0 0 | 43.25 665.32 ... |2.4 } 1st block 0 0 | 11.234 |-4.5 } 0 ...
0
votes
0answers
18 views

Can this function (implementing HTUnEscape) be optimized?

Came across the following piece of code in an UI application I need to maintain. int tool_unhex( char c ) { return( c >= '0' && c <= '9' ? c - '0' : c >= 'A' && ...
0
votes
1answer
28 views

Improving the redundant code I have while inserting to Cassandra

I have started working with Cassandra database recently. And I was trying to insert some data into one of my Column Family that I have created. Below is the code by which I am trying to insert into ...

1 2 3 4 5 38
15 30 50 per page