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
2
votes
3answers
169 views

Smallest letter in a string

As part of my college class, I have to write a program that returns the "smallest" letter in the string. Input is assumed to be a non empty string. "Smallest" is defined as: The smallest decimal ...
5
votes
2answers
100 views

Simple replacement for Redux in ES6

The idea about this code is that it's a full replacement of Redux — in 22 lines of code. ...
4
votes
1answer
134 views

Python Secure Implementation Of AES-256-CTR Using Cryptography.Hazmat

I've implemented a wrapper for AES 256 CTR mode using the cryptography.hazmat module, I am wondering if there are any vulnerabilities in my implementation, specifically about the counter and its ...
6
votes
1answer
232 views

Simplified Vector Implementation in C++

I have implemented a class Vector to learn about data structures and algorithms and how to implement them using C++. I have yet to implement some std::vector functionalities e.g. custom allocator ...
6
votes
3answers
944 views

Event loop in C++

Writing an EventLoop in C++. Few requirements, from a user perspective: Must be simple to use (as simple as the Javascript event loop) No type casting, no complex registering of event handler. Plain ...
2
votes
2answers
75 views

Creating a stack class in C++

Create a class called Stack for storing integers. The data members are an integer array for storing the integers and an integer for storing the top of stack (<...
9
votes
2answers
2k views

Linux Commands in Python

I've decided to write some Linux commands in Python. Below is a list, along with some constraints (if you're unfamiliar with Linux, the top of the program along has a description about each command ...
1
vote
1answer
503 views

HashTable implementation in Python 3

I have implemented a hash table. It works well. But if you think something needs to be improved, say it. This code was tested in Python 3.7.4. ...
0
votes
0answers
51 views

Bubble sort optimization

This bubble sort code is very slow compared to the original. ...
5
votes
1answer
149 views

Educational implementation of SHA256 in Rust

A few weeks ago I decided to have a look at the Rust programming language. After a few standard exercises I chose to try to implement the SHA256 hashing algorithm, because why not. The algorithm's ...
11
votes
2answers
206 views

YAAI (Yet another any implementation)

I am a C# game developer currently learning C++ and this is my second big-ish project (the first one being a vector implementation). This time I opted for implementing a mot-a-mot ...
-2
votes
3answers
235 views

Heap sort implementation in Python 3

This code relies on Python3.7.4 I'm learning Heapsort in python 3. Please show me the errors in my code. Runs on my computer but tell me if Python rules or not. ...
6
votes
3answers
338 views

constexpr SmallVector - std::vector like container on the stack

2 years ago I did this: SmallVector - std::vector like container on the stack now, 2 years later, I am reinventing the wheel again, this time with fully constexpr SmallVector. This time, because I ...
4
votes
2answers
123 views

Get list of all combinations from a set

Given a tuple of elements, in elementTupleParam and the number in each combination r, we compute all the possible combinations ...
11
votes
1answer
221 views

Portable BrainFuck Interpreter in ANSI C89

I wrote this BrainFuck interpreter in ANSI C89: ...
24
votes
4answers
3k views

IEEE 754 square root with Newton-Raphson

I have an implementation of the sqrt function that uses a combination of IEEE 754, packed bitfields, and the Newton-Raphson algorithm: ...
3
votes
1answer
132 views

Ring buffer with random access

I had an application where I really wanted a double-ended queue that supports random access. Java's ArrayDeque would have been perfect, except that it doesn't ...
3
votes
1answer
84 views

LeetCode Reverse Words in a String without using any java library

The following problem is from LeetCode: Given a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order. ...
5
votes
3answers
993 views

reverse a list of generic type

Q: Given a list, reverse the order of its elements (don't use collections). Here is my solution: ...
2
votes
1answer
96 views

transform list to array

Q: Write a method that transforms a list into an array (don't use collections or already implemented methods in lists, make your own method) I've come with this solution: ...
12
votes
1answer
174 views

Pure python range implementation

I implemented class Range as an equivalent to Python built-in range for practicing purposes. No features were added. Hope it ...
4
votes
1answer
394 views

Converting a binary string to hexadecimal using Rust

Once again, I am reinventing the wheel here to understand the fundamentals of rust. In a previous question I requested feedback on my function that performed a hexadecimal to binary conversion. In ...
5
votes
1answer
188 views

Converting a hexadecimal string to a binary string using Rust pattern matching lookup

I am getting started in Rust, and as a part of my first exercise, I decided to write a small program that converts a hexadecimal string to a binary string using a pattern matched lookup. I would ...
5
votes
4answers
1k views

Confirm the ending of a string

Challenge: Check if a string (first argument, str) ends with the given target string (second argument, target). This ...
16
votes
2answers
264 views

YAVI (Yet another vector implementation)

I am a C# game developer currently learning C++. I am trying to implement some simplified STL containers. Here is my implementation of vector, which does not have the allocator (because ...
8
votes
2answers
535 views

c++17 compatible std::bind_front alternative

One of the things that has been really exciting me in c++20 is std::bind_front. Using placeholders with std::bind and ...
13
votes
5answers
3k views

Stack class in Java 8

I have a exercise where I have to write a Stack class with the push and pop methods. The code compiles and works as it should. Are there better practices to use in my code? Is there something I should ...
7
votes
2answers
1k views

Python implementation of atoi

I made an implementation of atoi (ascii to integer) in Python a while ago for fun, and I'd like to know what I could do to improve it. ...
6
votes
3answers
98 views

Quicksort for ints

I have written the following quicksort without using online help. It seems to be fine, but is there anything to improve? ...
3
votes
0answers
138 views

Implementation of a hash table using safe Rust

I just finished reading the rust book and I am doing lots of little projects to practice and try to get better at writing idiomatic Rust. One of them involves implementing a hash table (I find it's ...
3
votes
1answer
43 views

Javascript Tree Class 2

This question is the second version of the code here. I'm writing a general tree class. Specifically, each node should have oen parent, some number of children, and hold a value. I'm looking for ...
5
votes
2answers
138 views

Quick Sort in C

I'd like to know if there's any issues with this implementation of qsort_r (which is not available in all implementations, so I'm trying to provide one that allows ...
3
votes
2answers
211 views

Javascript Tree Class

I got caught in the trap of implementing my own data structure. I've created a very general tree structure, where each node gets one parent, some children, and holds a value. I'm mostly looking for ...
6
votes
1answer
101 views

Generate music notes by specified key and scale

As a follow-up on isosceles' question, I have created a small API to generate the notes of a scale given the pitch class set and key note. I've added the reinventhing-the-wheel tag because I know ...
6
votes
2answers
1k views

Reimplementation of min() in Python

I'm reimplementing the min() function as an exercise (EDIT: not all the functionality of the python std library function, just the minimum of a list of numbers). ...
5
votes
2answers
160 views

Code Challenge: basic arithmic operations using only incrementation operator

Challenge Write a function that takes 2 integer operands left and right (both >= 0) and evaluates one of the following ...
6
votes
1answer
243 views

A standard-conforming C++17 std::optional implementation

I took quite some time to implement a fully standard-conforming std::optional in C++17. It turns out more sophisticated than I initially thought. My code is just ...
3
votes
0answers
107 views

Circular doubly linked list implementation in Cython

This is a follow-up from my previous question. In summary, I am trying to implement a BVH module with Cython and need a way to keep track of the volumes during the construction of the hierarchy. I ...
2
votes
1answer
221 views

Simple, flexible, and thread-safe key/value memory cache

MemoryCache.cs ...
5
votes
1answer
273 views

All-Python implementation of n-dimensional convolution

To better understand how discrete finite convolution works (read educational purposes) I wrote an all-python implementation of the convolution function. The idea was for it to give the same output as <...
1
vote
0answers
43 views

Determine the hyper-parameters of an Approximate Bayesian computation

I created my own Approximate Bayesian computation algorithm in Python 3 and I try to find the best hyper-parameters for it but it is really slow. This question is not about the math involved in it. ...
8
votes
4answers
2k views

Very basic singly linked list

Here is implementation for singly linkedlist. Any suggestions are most welcome ...
6
votes
2answers
86 views

Would log4j be more efficient to utilize than the logger I implemented (Code Below)?

I recently made a logger program implementation in my game engine. Which logs any thing that I send it in either a file or the System.out printstream. I use it like this: ...
2
votes
2answers
356 views

Staircase challenge - Python

Your task is to print all unique ways to climb a staircase of length n where, from each step, you can take steps of size x where ...
1
vote
1answer
67 views

Boolean class using shared referenced memory

To improve my knowledge I am trying to make a bool class from scratch, or derivative of. I am using MinGW g++11 compiler on a Windows 7 laptop. ...
2
votes
2answers
58 views

Implementation of enumerate

I'm trying to implement the enumerate built-in using iterators. So far it works but for unordered objects, such as sets or dictionaries, I'm not sure if this implementation is considered valid, ...
1
vote
1answer
57 views

shared_ptr alternative with no dependencies

An alternative to shared_ptr to minimize compile time. Intrusive. Reference count changes are not thread safe. (...
3
votes
1answer
98 views

std::function alternative with no dependencies

An alternative to std::function for when compile time is more important than runtime performance. Doesn't pull in any headers. (...
6
votes
1answer
160 views

STL-like vector implemention in C++

I attempt to write a STL-like vector, mostly to figure out how it works. I wonder which parts look weird or what I made stupid. Any kind of comment is appreciated: alloc.hpp ...
4
votes
2answers
116 views

Min Heap implementation [C++]

I've never had my C++ code reviewed before so I'd appreciate any feedback. Although my main focus was not on the implementation of the algorithm itself, any suggestions regarding improving it would be ...

1
2
3 4 5
16