Skip to content Skip to sidebar Skip to footer
Showing posts with the label Optimization

Is There A Faster Way To Add Two 2-d Numpy Array

Let say I have two large 2-d numpy array of same dimensions (say 2000x2000). I want to sum them ele… Read more Is There A Faster Way To Add Two 2-d Numpy Array

Python - Optimisation Of Perfect Number Search

p = [] for x in range(1, 50000000): count = 0 for y in range(1, x // 2 + 1): if (x … Read more Python - Optimisation Of Perfect Number Search

Should I Cache Range Results If I Reuse Them?

I'm relatively new to python, and I'm trying to optimize some code for a HackerRank problem… Read more Should I Cache Range Results If I Reuse Them?

Calculating The Factorial Without Trailing Zeros Efficiently?

I'm trying to improve the running time of the factorial calculation of the large number. The fi… Read more Calculating The Factorial Without Trailing Zeros Efficiently?

Find The Shortest Substring Whose Replacement Makes The String Contain Equal Number Of Each Character

I have a string of length n composed of letters A,G,C and T. The string is steady if it contains eq… Read more Find The Shortest Substring Whose Replacement Makes The String Contain Equal Number Of Each Character

How To Randomly Shift Rows Of A Numpy Array

I am looking for a more pythonic way of randomly shifting rows of a numpy array. The idea is that I… Read more How To Randomly Shift Rows Of A Numpy Array

Two Dimensional Optimization (minimization) In Python (using Scipy.optimize)

I am trying to optimize (minimize) a two dimensional function E(n,k) defined as follows: error=lamb… Read more Two Dimensional Optimization (minimization) In Python (using Scipy.optimize)

Optimizing Python Dictionary Lookup Speeds By Shortening Key Size?

I'm not clear on what goes on behind the scenes of a dictionary lookup. Does key size factor i… Read more Optimizing Python Dictionary Lookup Speeds By Shortening Key Size?