Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [reinventing-the-wheel]

For when you know you are reinventing the wheel, but are doing it anyways. Questions with this tag involve code that is already fully implemented (such as from a library).

Filter by
Sorted by
Tagged with
1 vote
1 answer
21 views

My iterative FFT is slower than my recursive FFT

I've implemented in Python a recursive FFT function and an iterative one. They're both correct (they both pass all unit tests) but, when I plot the complexity curves, I find that the iterative version ...
Gio Formichella's user avatar
4 votes
2 answers
357 views

convn Template Function Implementation for Image in C++

This is a follow-up question for conv2 Template Function Implementation for Image in C++ and conv3 Template Function Implementation for Image in C++. I am trying to perform n-dimensional convolution <...
JimmyHu's user avatar
  • 5,444
1 vote
1 answer
39 views

conv3 Template Function Implementation for Image in C++

This is a follow-up question for conv2 Template Function Implementation for Image in C++. Besides two-dimensional convolution, I am trying to implement three-dimensional convolution for 3D image in C++...
JimmyHu's user avatar
  • 5,444
3 votes
1 answer
255 views

imgaussfilt Template Function Implementation for Image in C++

This is a follow-up question for im2double and im2uint8 Functions Implementation for Image in C++, conv2 Template Function Implementation for Image in C++ and An Updated Multi-dimensional Image Data ...
JimmyHu's user avatar
  • 5,444
3 votes
2 answers
277 views

im2double and im2uint8 Functions Implementation for Image in C++

This is a follow-up question for conv2 Template Function Implementation for Image in C++ and An Updated Multi-dimensional Image Data Structure with Variadic Template Functions in C++. For performing ...
JimmyHu's user avatar
  • 5,444
6 votes
3 answers
1k views

Simple Container Class

I'm learning C++ and trying to create my own container class just for practice (I know about vector, list, map, set). I plan to improve this class and add new methods as I learn new material. Please ...
vansergh's user avatar
8 votes
2 answers
1k views

C# Linked List implementation

I am trying to learn C# and created this project to improve. I will be using C# professionally so a harsh critique is welcome. ...
Doruk's user avatar
  • 293
3 votes
3 answers
98 views

Determinant of matrix Python

This is an addition of my previous question Python matrix class. I've added a determinant function using Laplace expansion to my Matrix class. What I am looking for specifically is how 3x3 matrices ...
Linny's user avatar
  • 10.3k
8 votes
3 answers
2k views

is_decimal Function Implementation in C++

This is a follow-up question for is_number Function Implementation in C++. Considering G. Sliepen's answer and Harith's answer, I want to focus on decimal number here, therefore, ...
JimmyHu's user avatar
  • 5,444
8 votes
5 answers
1k views

Python matrix class

To prepare for my studies in linear algebra, I've decided to write a simple matrix class. This is the initial program, with functions to find the determinant and decomposition(s) to follow. I wanted ...
Linny's user avatar
  • 10.3k
8 votes
2 answers
1k views

Aho-Corasick algorithm implemented in C

I've been reimplementing the fgrep utility in C for fun & study, and so had to implement the Aho-Corasick algorithm. I'm ...
Knogger's user avatar
  • 285
1 vote
0 answers
44 views

Two Dimensional Discrete Fourier Transform Template Function Implementation for Image in C++

This is a follow-up question for An Updated Multi-dimensional Image Data Structure with Variadic Template Functions in C++. For learning purpose, I am trying to implement two dimensional discrete ...
JimmyHu's user avatar
  • 5,444
8 votes
3 answers
448 views

conv2 Template Function Implementation for Image in C++

This is a follow-up question for An Updated Multi-dimensional Image Data Structure with Variadic Template Functions in C++. I am trying to implement conv2 template ...
JimmyHu's user avatar
  • 5,444
5 votes
2 answers
955 views

An Implementation of UNIX wc shell utility

The implementation doesn't support the "-m" flag, and only works with ASCII, and has rather terrible output formatting in comparison with GNU's implementation of wc. Code: ...
Harith's user avatar
  • 9,462
4 votes
2 answers
440 views

naive C++ stack template class

I just learned Adapter Pattern, and I have used STL for some time. I know that the std::stack is a adapter for sequence container (say, ...
John's user avatar
  • 459
4 votes
2 answers
667 views

is_number Function Implementation in C++

I am trying to implement a function which can determine a string is a number or not. Both positive and negative integers / floating numbers are considered. The experimental implementation ...
JimmyHu's user avatar
  • 5,444
4 votes
0 answers
87 views

Image Rotation with Shear Transformation in C++

This is a follow-up question for Image Rotation and Transpose Functions Implementation in C++ and An Updated Multi-dimensional Image Data Structure with Variadic Template Functions in C++. I am trying ...
JimmyHu's user avatar
  • 5,444
4 votes
2 answers
173 views

Matrix Factorisation class packaging methods for factorisation of explicit & implicit data matrices using Gradient Descent, SGD and ALS

Attached below, and also as this GitHub gist, is code for a Python class I wrote as part of a personal learning/portfolio project on collaborative-filtering recommender systems via matrix ...
Cosmic Fan's user avatar
8 votes
3 answers
874 views

Split String Function Implementation in Python

For learning purposes, I am trying to implement Python's built-in function split. I am new to Python, and I know that str.split ...
JimmyHu's user avatar
  • 5,444
2 votes
1 answer
80 views

Scene Hierarchy with Translation, Rotation and Scale

This code represents an Entity Component that holds and manipulates an entity's local and world transforms, dealing with hierarchy and translation/rotation/scale transformations. The code is written ...
Daniel Marques's user avatar
4 votes
2 answers
113 views

(Another) text formatting method with word wrapping in Java

Please take a look at my code for (simply) formatting/wrapping a text. Is there something to improve? Here are the properties the method should have: (updated) Every space character (i.e. ...
Tobias Grothe's user avatar
2 votes
1 answer
181 views

Evaluate a prefix expression

The algorithm involves using two stacks. One stack (call it token_stack) holds the operators (like +, - etc) and operands (like 3,4 etc) and the other stack (call it count_stack) holds the number of ...
Harith's user avatar
  • 9,462
2 votes
2 answers
104 views

Evaluating Polish Prefix Notation and Polish Postfix Notation

In Polish postfix notation, the operators follow their operands. For example, to add 3 and 4 together, the expression is 3 4 + rather than 3 + 4. The conventional notation expression 3 − 4 + 5 becomes ...
Harith's user avatar
  • 9,462
5 votes
3 answers
425 views

Bare bones base 64 encoding/decoding

I wrote a bare-bones, no fluff, base 64 library in C. My goal was to make it as small as possible. I'm wondering if there are any further size optimizations I can make (without sacrificing too much ...
Daniel Walker's user avatar
3 votes
1 answer
213 views

Calculate the maximum number of decimal places with which all floating point numbers can be represented in a range in C++

I'm looking for a function in C++ that can determine, how accurate all floating point numbers in a given range can be represented as strings, without the use of e.g. boost library, etc. Please take a ...
Tobias Grothe's user avatar
3 votes
0 answers
83 views

Implementation of damage calculation based on Final Fantasy 9

I am re-implementing the damage calculations for the game Final Fantasy 9, based on the documentation provided in the GameFaqs Battle Mechanics Guide. Currently, I have two main methods for performing ...
FlameHorizon's user avatar
3 votes
2 answers
295 views

Calculate the base 10 log with loops in Java without using Math

I'm looking for a simple way to calculate the logarithm without using java.lang.Math, just out of interest. Here's my try (I adopted some code parts from this ...
Tobias Grothe's user avatar
11 votes
3 answers
2k views

SHA-256 Implementation

I've been working on a byte-oriented SHA-256 implementation for educational purposes. I then tested it using the NIST CAVP tests found here. All tests pass but I would appreciate some feedback from a ...
dRevan25's user avatar
  • 113
1 vote
3 answers
210 views

A shared pointer which can delete the managed object before the usage count reaches zero

When I was working on my game engine, I needed to know if a game object has been destroyed or not. So, I decided to use std::shared_ptr. But the standard shared ...
LooksForFuture's user avatar
10 votes
4 answers
2k views

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 ...
fraber's user avatar
  • 179
5 votes
1 answer
443 views

Simple malloc and free implementation

I am trying to implement a simple malloc and free. The buffer is a char array. Each chunk's address is calculated using the size of the previous chunk. ...
user3280530's user avatar
2 votes
1 answer
164 views

Shared_ptr Implementation with Derived class Awareness

Another shared_ptr implementation. My main idea was to write it in a way you could do: ...
KimGiacinto's user avatar
3 votes
2 answers
189 views

String partial implementation using a vector

I saw few similar solutions, but they all relied on C-style arrays and str utils, so I thought I would write a higher level C++ only implementation with a vector as an exercise. I have not implemented ...
KimGiacinto's user avatar
5 votes
1 answer
1k views

Determine if it is EU summer time in Java

I wanted to write a utility method for learning purposes to determine if a given date (year, month and day) falls within EU summer time or not, without using any of the Java library methods. Is here ...
Tobias Grothe's user avatar
0 votes
1 answer
281 views

WordPress Plugin for WebP/AVIF Image Conversion

I'm looking for feedback on a WordPress plugin I developed for automatically converting images to WebP and AVIF formats. The goal is to optimize image loading performance. The plugin has the following ...
KermitTheFrog's user avatar
8 votes
3 answers
3k views

C++ std::optional implementation

Took a shot at implementing a subset of std::optional functionality. A lot of core features are there but some things like converting constructors, etc are missing ...
jdav22's user avatar
  • 361
3 votes
2 answers
1k views

C++ std::any Implementation

Took a shot at implementing std::any. I think this should cover a majority of the functionality of the standard version, except there may be some missing auxiliary ...
jdav22's user avatar
  • 361
2 votes
2 answers
435 views

C++ std::shared_ptr implementation

Took a shot at implementing std::shared_ptr, with a thread-safe refcount and weak count. Didn't do weak_ptr, I'm doing this for ...
jdav22's user avatar
  • 361
6 votes
4 answers
652 views

C++ custom string class implementation

I recently had an interview where I was tasked with implementing a custom C++ string class without using the STL. The interviewer provided the function signatures and variable declarations, specifying ...
Jacob's user avatar
  • 131
4 votes
1 answer
167 views

C++ custom vector class implementation

I've developed a custom vector class in C++, complete with functionalities like assignment, push_back(), emplace_back(), pop_back(), clear(), and size(). I would greatly appreciate any feedback on ...
Jacob's user avatar
  • 131
1 vote
2 answers
83 views

2D Point subclass of complex builtin

I'm writing a pure-python geometry tool for technical drawings / computational geometry (not a solver, as a solver has to work with constraints). I've already mentioned a previous version on code ...
ToAskOrNotToAsk's user avatar
3 votes
1 answer
301 views

Non-recursive topological ordering, starting from given nodes, for Guava graphs

This method returns the topological ordering of a Guava graph starting from a given set of nodes. It's from my personal project github.com/jbduncan/guava-graph-utils, where I'm exploring utilities for ...
jbduncan's user avatar
  • 151
2 votes
2 answers
125 views

Binary search tree with Iterators

One more BST implementation with iterators added. Did not manage to find another implementation with iterators and it is my first attempt at implementing them so thought to check on your opinion: <...
acd's user avatar
  • 107
1 vote
1 answer
102 views

Implemented a basic dictionary in python using lists as linked list and murmur hash as a hash function

...
piepi's user avatar
  • 823
2 votes
1 answer
96 views

Yet another std::unique_ptr implementation

I know I haven't implemented many methods, and haven't specialized it for T[], but I just want to see if what I coded is good or bad. ...
jamesee's user avatar
  • 21
5 votes
2 answers
210 views

C++ UniquePtr Implementation

Took a shot at implementing std::unique_ptr. Code: ...
jdav22's user avatar
  • 361
8 votes
2 answers
385 views

C++ std::vector Implementation

Implementation of the vector class in C++ for learning purposes. Tried to implement interesting parts from the API shown on cppreference.com, but some elements like ...
jdav22's user avatar
  • 361
7 votes
2 answers
203 views

shared_ptr implementation code - first cut

I've written an implementation of shared_ptr. It doesn't support weak_ptr (yet) but below is the code. I'd appreciate any feedback, comments. ...
Greg's user avatar
  • 71
5 votes
1 answer
162 views

Set implementation

I believe reinventing the wheel is in fact a good learning exercise. How can I improve my Set implementation without just copying ...
Sergey's user avatar
  • 581
1 vote
1 answer
146 views

Implement the Swift pow(base, exp)-function yourself

Task: Implement a function, which accepts two integers and results the first number raised to the power of the second number. Both numbers have to be positive. Examples: The arguments 4 and 3 shall ...
michael.zech's user avatar
  • 4,358

1
2 3 4 5
21