# Tag Info

Accepted

### Prettify math formula in code

Let me quote the wonderful book Numerical Recipes in C++ (but also applicable): We assume that you know enough never to evaluate a polynomial this way: ...
• 698
Accepted

### Benchmarking things in C#

Small issues before I get into the big one: Please make those setters private. The caller of this code has no business changing any of those values. Don't use ...
• 14.6k

### Benchmarking things in C#

The problem with an approach like that is that you you don't take into account that switching processors/cores is taking some time which will fake the results. This can be avoided by setting the ...
• 50k
Accepted

### Calculate mean, median, and mode in Rust

Learn to love rustfmt. For example, the Rust standard is 4-space indents. Learn to love Clippy, which can show you the more idiomatic way to iterate over a collection: ...
• 8,308
Accepted

### C++ Coin flip simulator and data collector

There's a lot that can be improved here, so I hope that these suggestions are useful to you. Don't abuse using namespace std Putting ...
• 64.4k

### Prettify math formula in code

As it turns out, a similar question was asked recently on Math.SE. Rather than reinventing-the-wheel, take advantage of built-in functionality in Python. Your ...
• 142k

### Standardly deviated Fibonacci

I have found a couple of things that could help you improve your code. Don't abuse using namespace std Putting ...
• 64.4k

### Prettify math formula in code

I'll only address the so-called "magic numbers" that several reviewers have mentioned. Sometimes, when you're working in pure mathematics, what seems at first glance to be a "magic number" really isn'...

### Prettify math formula in code

Instead of math.pow, use the builtin ** operator. You don't need the \s at EOL, because the ...
• 416
Accepted

### Shoe shine shop model in Rust

Correctness of the solution On reflection, I'm not sure either the C++ or the Rust code solves the problem as stated. I'm not completely sure I understand the shoe shine shop model so I may be wrong. ...
• 1,034

### Prettify math formula in code

Not sure if this helps but you could easily define a function to evaluate the value of a polynom at a given position ...
• 28.7k

### Unbreakable average program

The program cannot be made totally unbreakable. ...
• 481
Accepted

### Find the most frequent integer in an array

Your original Python code translates line-for-line into C++11 as: ...
• 19.1k

### Markov-chain sentence generator in Python

chooseNextWord distorts the probabilities. For example, consider a list of 3 words with the inherent probabilities $\frac{1}{3}$, $\frac{1}{3}$, $\frac{1}{3}$...
• 53.4k

### Benchmarking things in C#

You've got some pretty poor variable names there. For example, what's m2 supposed to mean? I don't like the fact, that result generates itself. I would rather have ...
• 13k
Accepted

Bug This calculation looks suspiciously buggy: int tzm = ((double) avg * 3 + TEZA) / 4; Why are you taking avg, which is ...
• 142k
Accepted

### Calculate min, max, mean and median out of array

I see a number of things that may help you improve your program. Don't violate const The calculate_median routine takes a <...
• 64.4k

### Chi Square Independence Test for Two Pandas DF columns

I would try to use existing pandas features where possible to keep this code minimal - this aids readability and reduces the possibility of bugs being introduced in complicated loop structures. ...
• 131

...
• 19.1k
Accepted

### Counting density of Python code

The docstrings are vague. Documentation needs to be precise and complete. It should answer questions like "what arguments should I pass?" and "what does it return?" For example, "go through the AST ...
• 49.2k

### Newton-Pepys, common birthdays and other probability simulations in Python 3

1. Design I think that using the @mean_of_experiments decorator is not the best approach to this problem: There might be cases where you want to run the ...
• 49.2k

### Program to accept numbers, then calculate the mean, median, and range

On top of Thomas Ward answer, here is a short and important comment: More beautiful functions Your functions are performing some mathematical computations and handling the formatting to show the ...
• 28.7k
Accepted

### Calculating and displaying score statistics using C# 6.0 features

I prefer to use explicit access modifiers -- it keeps everything uniform: you have internal int[][] JaggedArray so I'd make the others like ...
• 11.5k

### Unbreakable average program

You are doing way too much work to validate the input; the Scanner already has a method for reading doubles: ...
• 13.2k

### Unbreakable average program

Useless code On the first line of code, I already saw a problem: double[] nums = new double[4]; nums = inputHandler(); Why do you allocate an array for <...
• 28.4k

### Median Calculator

Please name your variables appropriately. Single-letter variables are in most cases sub-optimal and make it needlessly hard for the you-in-six-weeks to figure out what it does. I'm fairly sure your ...
• 12.7k
Accepted

### Algorithms to find statistical information of an array

Glaring Deficiencies Let me venture here that your getMedian method is slower than your getMode method. Thanks to your ...
• 2,251