Performance is a subset of Optimization: performance is the goal when you want the execution time of your program or routine to be optimal.

learn more… | top users | synonyms (4)

3
votes
3answers
53 views

Reversing a linked list (Java)

Triggered by an interview question (I didn't answer during the interview) I wrote a Java program to reverse a linked list. I went with a loop-based approach instead of recursion. I would like to know ...
10
votes
6answers
536 views

Bash script that lowercases files

I have the following bash script that: Finds all files with .cfc and .cfm extension and converts them to lowercase Stores the ...
5
votes
4answers
183 views

Creating a grid to the specified size using lists

My code creates a "grid" of empty places, where 0 is used as the place holder, in a size specified by the user. I was wondering if there were more efficient ways of doing this,or perhaps ways that ...
2
votes
1answer
47 views

Beginning of a tower defense game, using pygame

I'm currently working on my first project and I have been programming in python for 4 days now. I currently have a dilemma where my code is running too slowly. I don't want you to make a full review, ...
5
votes
0answers
26 views

SVG mosaic creator

Although my code works as expected, there are a few gotchas. A single row is not filled at once; instead, I can see partially filled rows during the rendering process(Fixed in the updated code below....
3
votes
1answer
55 views

Implement a queue using two stacks

I tried to implement a queue using two stacks. I saw there are questions about this topic, but in my example, I used build-in stack from java. My question is, can someone give me some advice to make ...
3
votes
0answers
52 views

Implementing a tensor product formula

Recently, I would like to use C to implement the following formula: $$\mathbf S(u,v)=\sum_{r=i-p}^{i}\sum_{s=j-q}^{j}N_{r,p}(u)N_{s,q}(v)\mathbf P_{r,s}$$ Namely, $$ \left(N_{i-p,p}(u),\cdots,N_{i,...
4
votes
0answers
11 views

Word VBA Code to Automate Table Captioning

I have a Word VBA script that auto-generates a table caption based on user input & a previous heading. Its purpose is to speed up editing & formatting of massive software documents (like the ...
2
votes
2answers
56 views

SPOJ ADDREV challenge - Adding reversed numbers

I'm a beginner Python (2.7) programmer, and I've just started solving basic problems on SPOJ. I correctly solved the ADDREV problem (http://www.spoj.com/problems/ADDREV/), however my code takes 0.06s ...
7
votes
2answers
741 views

Looking for primes with all-different digits

I recently answered a question on Mathematics Stack Exchange, where I used a small Python program to check the following : For all 6-digit numbers, with all digits being different, choosing the ...
3
votes
1answer
155 views

“Parking” challenge solution

This is the problem statement. I have submitted successfully a \$O(n^2)\$ solution and I would like to know if there is a way to improve the running time to, maybe, \$O(n \log n)\$. Having dropped ...
3
votes
0answers
42 views

Hackerrank New Year Chaos

My code given below will produce the correct output but it tends to take way too much time with larger data thus timing out for some of the test cases. I've linked to the problem description here: ...
1
vote
1answer
35 views

Finding unique items in the array

I was reading this code where author claims that its the fastest implementation which I doubt, hence I decided to write my version of the same problem. ...
3
votes
1answer
24 views

Tracking orders efficiently using a Python class

I've written a Ledger class for a daemon process, which is supposed to keep track of an exchange's orderbook. My main concern is the way I keep track of the orders -...
1
vote
1answer
21 views

Efficient text to binary conversion in Java

I wrote a Java FX application that translates binary to and from String and numbers in Java. Whenever the program is translating large amounts of text to binary it takes a very long time, and leaves ...
8
votes
3answers
236 views

PrimeFactorize method for int

I have written this PrimeFactorize utility method in C# (using LINQPad) which works fine, but feels like it is a bit slow, I was wondering what might be improved. ...
4
votes
1answer
274 views

Guess the chocolate box

I'm new to this competitive programming world. This morning I came across this question, which required the time to be less than 1 sec. But my code runs for 1.000069 sec, thereby rejecting my solution....
4
votes
2answers
55 views

Implementation of a queue for digicode-like system

What it is about I created an application where you need to push invisible buttons in a certain order to unlock the advanced mode. To handle this, I wanted to use a queue (FIFO) of my own, adapted to ...
20
votes
6answers
2k views

Check if a Sudoku board is filled out correctly

The code below takes a filled out Sudoku board of size NxN, with sub-blocks of nxn, and checks if the solution is correct. main_function takes a board as input. ...
6
votes
2answers
742 views

Algorithm to say if win or lose using player's rating and randomness

I wrote a small simulator to understand the Elo rating system. I can create players, matches and tournaments, and I want to be able to predict the match ending depending on the rating of each player ...
0
votes
0answers
9 views

Car dealer listing

I am using PL/SQL. I have the following SQL query: ...
3
votes
2answers
59 views

Optimize a simple and quick python script for transposing a .csv file

I need to transpose the following file output1.csv, which is is a result from a quantum chemistry calculation into a single colum efficiently: ...
3
votes
1answer
33 views

PHP & AJAX CAESAR CIPHER ENCRYPTED chat script - Slow in performance

I have made an attempt to make a chat script and its working as required but the problem is that it is slow on slower connections and sometimes even on fast connections. Sometimes while loading the ...
9
votes
4answers
2k views

Binary difference checker

My code needs to take two ints and then check those ints to see if their binary representations have any differences. The ...
1
vote
1answer
13 views

Network graph canvas display using Tkinter

I made a little application (for windows, but easily compatible with linux by just changing some lines) for displaying a little network graph using Tkinter and Python. I basically draw lines higher ...
6
votes
3answers
140 views

Python Takuzu solver

If you are unfamiliar with the logic puzzle game Takuzu, I learned how to play it and was inspired to make the project from this challenge posted on reddit. The short version of the game is it's a ...
1
vote
1answer
90 views

Horizontally concatenating the entries of two matrices, and padding with NaNs

I have two matrices a and b that have, on each line, some values (null or not) and then a bunch of zeros at the end. I want to ...
3
votes
1answer
50 views

A module to make JSON in Python easier

I recently wrote the livejson module as a way to make working with JSON in Python easier. The idea of the module is that you initialize a livejson.File, and then ...
5
votes
2answers
78 views

Finding product palindromes

I am new to perl and want some help in tuning this script if possible cause it takes time if I increased my array. also if I use warnings I get a lot of warnings ...
5
votes
1answer
131 views

Broken keyboard challenge

Inspired by Reddit r/dailyprogrammer Help! My keyboard is broken, only a few keys work any more. If I tell you what keys work, can you tell me what words I can write? The program works fine, ...
7
votes
0answers
52 views

Create edges from cells

I have a (large) number of nodes and (triangular) cells, e.g., cells_nodes = [ [0, 3, 1], [0, 2, 3] ] This example represents the small mesh (...
-1
votes
0answers
49 views

Find the possible mathematic expressions from the given integers to evaluate a value

How can I decompose this code into multiple threads so that it can run in parallel and enhance the efficiency (speed)? Can anyone suggest how I can use OpenMP here and where I can apply an OpenMP ...
0
votes
2answers
100 views

C++ XOR Function

This XOR function is costing my program too much time (specifically the conversions.) How can this code be made faster? ...
2
votes
0answers
52 views

In-memory B-Tree

I know B-Trees are meant to be used for external memory, but I implement it to understand the algorithms involved in insertion and deletion. Also, I didn't use a vector because I was asked not to use ...
3
votes
1answer
47 views

Vampire number generator

Inspired by Reddit r/dailyprogrammer A vampire number v is a number v=xy with an even number n of digits formed by multiplying a pair of n/2-digit numbers (where the digits are taken from the ...
3
votes
2answers
63 views

Distinct unordered pairs of an array which satisfy a condition

I came across the below problem in a coding challenge: Let's define 2 functions, \$F(i)\$ and \$Val(i,j)\$, for an array \$A\$ of size \$N\$ as follows: $$ \begin{align} F(i) =& \sum_{j=i+1}^{N} ...
4
votes
1answer
98 views

Tetris random piece generator

I was inspired by this Reddit /r/dailyprogrammer challenge: Contrary to popular belief, the tetromino pieces you are given in a game of Tetris are not randomly selected. Instead, all seven pieces ...
5
votes
1answer
73 views

Reversing a word or sentence

Was just wanting some general feedback on the below code regarding 1. Readability 2. Structure 3. Efficiency ...
4
votes
1answer
61 views

Recursive Breadth First Search Knights Tour

This program was written on Windows 7 using Visual Studio 2012 Professional. Some of the issues encountered may have been fixed or changed in a more recent version. This is a quote from my second ...
0
votes
0answers
30 views

Palindromic prime search using the Sieve of Atkins

I am working on a project that deals with prime numbers and am currently looking for a way to make the function max_palprime() work faster and possibly simpler. ...
3
votes
3answers
78 views

Searching values of range X in range Y

This allows me to search each cell J4:J6525 in range K4:K6525. If it is found it will paste the values in Offset(0, 2) (column M). I run it for files with more than 60000 lines, and sometimes much ...
4
votes
2answers
87 views

A String.prototype.diff() implementation (text diff)

I just had the idea to develop an algorithm to calculate and highlight the difference between two strings. I know that there are already some libraries to do the job but i just tried to make my own. I ...
5
votes
3answers
240 views

Finding the duplicate with an array with 1,000,000 integers between 1 and 1,000,000

I recently had an interview and got to phase 2 which is a coding assessment. One of the questions was: Given an array with 1,000,000 integers between 1 and 1,000,000, one integer is in the array ...
1
vote
1answer
37 views

Solving for a seed value in R

I'm trying to reproduce a gbm model which was estimated without a set.seed value. To do so I need to determine what seed was ...
0
votes
0answers
38 views

Permutations Script Needs Optimization

I have functions of permutation : ...
4
votes
1answer
53 views

Custom Python 'Server Status Checker'

I've written a home-grown solution for checking the status of my servers. This is both an exercise for me in learning further about Python, but it's also critical to status-checking critical things ...
5
votes
2answers
56 views

Extract the largest value for each day from a matrix

I have a matrix in which the right-most elements are repeated YYYYMMDD dates in descending order, for example: ...
1
vote
1answer
68 views

Neural net in C++

I wrote a Matrix struct and a neural net that uses it. Why is this slow? Gprof blames Matrix::operator()(int, int) which I ...
0
votes
0answers
46 views

Fastest way for multiplying a matrix to a matrix [migrated]

Let A and B be n\$\times\$n matrices. In my code this multiplication takes one minute, is there any way or packages that can make this calculation faster? I only found a command in R for a matrix by ...
3
votes
1answer
50 views

Copy sheet contents faster in Excel

I have code that opens a workbook and copies the sheet to the workbook running the code. I know activating is generally bad for speed but I can't figure out how to speed this up anymore. The data ...