Skip to main content

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
4 votes
0 answers
42 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
  • 4,748
4 votes
2 answers
160 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
839 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
  • 4,748
2 votes
1 answer
72 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
105 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
154 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
  • 5,844
2 votes
2 answers
90 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
  • 5,844
5 votes
3 answers
415 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
165 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
2 votes
0 answers
78 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
279 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
165 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 ...
Mohammad Armin Niknami'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
425 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
131 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
177 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
271 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
333 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
568 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
157 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
79 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
209 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
100 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
100 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
88 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
201 views

C++ UniquePtr Implementation

Took a shot at implementing std::unique_ptr. Code: ...
jdav22's user avatar
  • 361
8 votes
2 answers
344 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
194 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
160 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
  • 541
1 vote
1 answer
136 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,294
3 votes
1 answer
120 views

std::list reimplementation for practice

I used cppreference list to implement this simplified std::list. The CXX_STANDARD is 11. My questions are the usual: Is the ...
Abner's user avatar
  • 39
4 votes
2 answers
600 views

Constexpr flat_multimap

About the Reasoning I wrote a flat_multimap because it was slightly more efficient to read/write from disk (contiguous memory block) and because it would keep the logarithmic efficiency from a tree (...
FreezePhoenix's user avatar
7 votes
3 answers
197 views

C++ String Class Reimplementation

I started learning C++ about a week ago and I was hoping somebody can critique my code. I decided to implement my own basic String class just for the sake of applying all that I've learned about ...
Janriz Libres's user avatar
6 votes
3 answers
381 views

Unit testing a Linked List implementation in C++

Recently I wanted to use the gtest library to unit test my program but for some reason, it's incredibly hard to make it work and configure (at least for me it was), ...
I_throw_but_dont_catch's user avatar
2 votes
0 answers
204 views

Minimal Chess Web GUI with Flask

Being a big chess fan, I finally started developing my own chess tool, however I'm already quite dissatisfied with where it's going... folder structure: ...
Mantas Kandratavičius's user avatar
2 votes
1 answer
582 views

Find all permutations of string using recursion

Background: I am somewhat new to programming and only two weeks into learning Python. Currently trying to improve my understanding of recursion, which has been a tough concept for me to implement. ...
b-mitch's user avatar
  • 21
8 votes
1 answer
211 views

Lightweight general-purpose graph library in C++

As a personal side project I started building a graph library in C++ (I know, very original). The code is open source, but for the purpose of this question I will provide the relevant details and the ...
Bobray's user avatar
  • 81
1 vote
3 answers
151 views

C++ getline implementation for custom stdlib

I'm writing my own "standard library". It relies on nothing but syscalls, so I've had to make my own implementations of everything, including getline (...
Fuzzy Muffin's user avatar
2 votes
2 answers
115 views

Python Logger Implementation

I have developed an implementation of a logger in Python. I know that Python already has a built-in logger, my goal with this is to get feedback and suggestions for improvement, particularly about ...
nabla-f's user avatar
  • 163
6 votes
3 answers
2k views

Implementation of a shared pointer constructors and destructor

I am writing my simple shared pointer. I am asking to review existing functions (understand that my implementations is not full, e.g now operator*) Review please ...
mascai's user avatar
  • 379
7 votes
1 answer
441 views

C++ mutex-like class using std::condition_variable

On a project I'm working on, I have a need for a mutual-exclusion primitive behaving like std::mutex or std::recursive_mutex, ...
Macmade's user avatar
  • 171
6 votes
2 answers
302 views

A selection sort implemented in Python

I'm not proficient at Python. My question is twofold: whether this selection sort algorithm implementation for number lists could be considered clean code (in the sense of being modular and ...
Piovezan's user avatar
  • 257
2 votes
1 answer
140 views

Comparator aware `flat_set` implementation

I am currently implementing a flat_map like container in C++, and had problems with the comparator used. Thus, I reduced it to the bare minimum which I will present here. (In particular, my code here ...
tommsch's user avatar
  • 243
3 votes
1 answer
156 views

Optimizing my sorting function

I created my own list sorting function with Python: ...
U13-Forward's user avatar
11 votes
5 answers
2k views

Portable Object-Oriented WC (Linux Utility word Count) C++ 20, Counts Lines, Words Bytes

This question Code lines counter prompted me to write my own line counting program. I program on both Windows and Linux and I know about the Linux utility wc. The command line and output format are ...
pacmaninbw's user avatar
  • 23.8k
1 vote
0 answers
162 views

Priority Queue implementation using a Heap [closed]

I'm working on a custom implementation of A-Star and so I had to also create a Priority Queue and so I had to create a Heap. I'm quite happy with my Heap but I'm a bit worried about my Priority Queue: ...
Caïn's user avatar
  • 111

1
2 3 4 5
20