Code Review Stack Exchange Community Digest

Top new questions this week:

Number to text in Python

I'm kind of new to programming and I would need a suggestion whether there is a better way to solve this exercise. I need to write a function dict_of_numbers() that ...

python python-3.x reinventing-the-wheel  
user avatar asked by fraber Score of 10
user avatar answered by J_H Score of 9

Gaussian elimination algorithm in C++

Given: j-g-h-i=0 a+b-c-j=0 c+i-d-e=0 e+g-f=0 And known: a=10 b=7 d=3 e=2 f=3 j=14 I want to solve this (or similar equations) ...

c++ algorithm  
user avatar asked by Tobias Grothe Score of 7
user avatar answered by G. Sliepen Score of 9

Optimizing __getitem__ for a bioinformatics script in Python

I'm writing a script for a bioinformatics application in Python that iterates through several sequences looking for amino acids in specific positions to calculate their frequency in relation to a ...

python performance bioinformatics  
user avatar asked by Eduardo Menotti Score of 6
user avatar answered by J_H Score of 2

In-memory cache class

The following is a simple cache that I have written in java. It uses the LRU replacement policy and also evicts items based on a refresh interval (default 5 secs). Right now, the class is not thread ...

user avatar asked by Nithin Score of 5
user avatar answered by user278398 Score of 2

Spatial radius search in Boid simulation

I am working on a Boid simulation with 10,000 boids. I've successfully utilized geometry shaders and an array<GLfloat[3], MAX_BOIDS> for vertices to enhance ...

c++ performance search simulation  
user avatar asked by nowox Score of 4
user avatar answered by G. Sliepen Score of 3

Advent of code 2023 day 1 mostly in Bash

It's that time of the year again! Although there's no more Winter Bash, we can still have all the Bash we want in winter ;-) Part 1 To paraphrase the description: For each line in the input: Find ...

programming-challenge bash  
user avatar asked by janos Score of 3
user avatar answered by choroba Score of 1

Simple hash table written in C with REPL

This is a simple hash table I've written in C. It is a closed-addressing hash table with TABLE_SIZE number of buckets. The hash ...

c hash-map  
user avatar asked by Amir reza Riahi Score of 3
user avatar answered by G. Sliepen Score of 4

Greatest hits from previous weeks:

Get the value of the name attribute of each element with class="class"

I need a function to get the value of the name attribute of each element with class="class". I was wondering what is the best way to do this, performance-wise. Currently I'm using jQuery and doing it ...

javascript jquery html dom  
user avatar asked by Alex Score of 9
user avatar answered by Daniel Imms Score of 9

Project Euler #1: Multiples of 3 and 5

Challenge Description: If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of ...

python programming-challenge python-2.x  
user avatar asked by MTHL Score of 27
user avatar answered by Heslacher Score of 15

C++ quiz game with 25 questions

I created a quiz game program with 25 questions, 4 answer choices, correct answer and 4 points awarded per question. I realize this code isn't the best; I am still a beginner and this is my first ...

c++ beginner object-oriented quiz  
user avatar asked by Torrjv Score of 14
user avatar answered by Rakete1111 Score of 7

First C# program (Snake game)

I've just started out using C#. I've used Scratch (drag and drop programming for kids) for quite some time. Since Scratch didn't have classes and methods I have a feeling this code could be a lot more ...

c# beginner console snake-game  
user avatar asked by Wagacca Score of 14
user avatar answered by asibahi Score of 8

Replacing letters with numbers with its position in alphabet

If anything in the text isn't a letter, ignore it and don't return it. a being 1, b ...

python strings python-2.x  
user avatar asked by nexla Score of 26
user avatar answered by alecxe Score of 31

String.IsNullOrEmpty in JavaScript

I am aware of it being frowned upon to do something like write C# in JavaScript. (see this if you don't know what I'm talking about) But as a judgement call, I think we could stand to have a ...

javascript strings null  
user avatar asked by Terrance Score of 59
user avatar answered by ndp Score of 125

Removing elements on a List while iterating through it

I needed a way to remove elements on a List while iterating through it. Supposedly something like this (illegal code): ...

user avatar asked by lxcky Score of 63
user avatar answered by Simon Forsberg Score of 80

Can you answer these questions?

Simple Tic-tac-toe in Python

I am a beginner programmer who coded a simple Tic-tac-toe in Python for practice. Any feedback, especially regarding best practices and tidying up the code, is appreciated. ...

python beginner game tic-tac-toe  
user avatar asked by smwt Score of 1

SEDE query to count questions, views and unanswered for a set of tags

This query selects the number of SO questions, the number of views and the number of unanswered questions for each tag (the list of the tags is the user input). It works fine when it works, but it ...

performance time-limit-exceeded t-sql stackexchange  
user avatar asked by Yulia V Score of 2

Ringbuffer over a const generic Array in Rust

I implemented this generic ringbuffer over a const generic array with the usage of the MaybeUninit type. Is there something which is maybe unsound (having the lines ...

rust generics circular-list  
user avatar asked by Lockna Score of 2
You're receiving this message because you subscribed to the Code Review community digest.
Unsubscribe from this community digest       Edit email settings       Leave feedback       Privacy
Stack Overflow

Stack Overflow, 14 Wall Street, 20th Floor, New York, NY 10005