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
9
votes
5answers
3k views

Palindrome checker program

I've been studying Java for some days and I'm just now starting to make some simple programs, I'd like to know if there's any 'noob' mistakes or habits that I could avoid. In other words: how could ...
11
votes
3answers
2k views

My approach to sorting algorithm

For practicing purposes, I had the idea of making a sorting algorithm in Python. My approach to it was to iterate through a given unsorted list to find the shortest number in it, add the number to a ...
0
votes
2answers
87 views

Array indexing with copy constructor, assignment operator and index operator overload

The code below is a custom array class that handles indexing, copying, printing, etc. explicitly. Is there a better approach for specification (declaration and definition) of the assignment operator (...
5
votes
4answers
591 views

Reviewing custom array List class of java

I am using JDK 12 and I have developed the custom array list in java with a basic understanding Please let me know if there are any flaws in it that I can correct the same First the POJO class <...
1
vote
1answer
37 views

DI container with auto-wiring feature

So I decided to write my own DI container for educational purposes and would like some feedback on how I can improve the quality of my code. I'm not sure about the documentation as most of my ...
5
votes
5answers
3k views

C++ Calculator for complex numbers - follow-up

After following the suggestions from the first question on that topic (link), I'd like to show you the result now: ...
11
votes
3answers
3k views

C++ Calculator for complex numbers

I've written a little calculator in C++ for complex numbers: ...
2
votes
1answer
65 views

Get word frequency of a txt file and save it to linked list

I'm a novice in C++. I want to do three things: Get the number of lines in the file Get the number of total words in the file Get each frequency of each "unique ...
10
votes
2answers
1k views

Graph coloring project in C++

I recently had to submit my 12th grade final project in C++, so I decided to make a game engine! That panned out just as you would expect (I am not touching OpenGL until they touch OOP), so I switched ...
8
votes
3answers
684 views

Custom Logger class

My custom Logger class works just fine. However, the class is not intended for making instances of. Because there is really no reason to make instances of my class, ...
3
votes
2answers
42 views

classList fallback (IE & older browsers)

I'm trying to make some JS code more browser compatible. So I've written an alternative to JS's classList providing its .add(), <...
3
votes
3answers
113 views

Generic Singly Linked List in C++

I am currently working on implementing some data structures as a way to learn C++. I'm coming mostly from a Java background so I was hoping to get some feedback regarding this implementation of a ...
0
votes
1answer
66 views

Cryptopals first challenge - hexadecimal to base64

I've just started the cryptopals-challenge, and now wanted to show my solution to the first challenge here: ...
5
votes
0answers
94 views

Scanning a string into a list of tokens

Here is my code: ...
1
vote
1answer
79 views

Optimizing Hash Table

I am trying to write my own implementation of a hash table (hash map) in C++. It turns out that my code is unoptimized as I can't pass performance tests. Can you please give some advice for ...
10
votes
6answers
1k views

Intersection of sorted lists

I don't like this function. Looks too imperative. It takes two sorted lists and returns a sorted intersection of the two lists. There is an implicit assumption that there are no duplicate elements in ...
3
votes
0answers
115 views

Sorting Algorithms in C++ - Insertion Sort and some variants

I'm learning C++, data structures and algorithms and decided to implement some sorting algorithms using generic iterators instead of array indices. This post contains code for insertion sort and ...
3
votes
1answer
98 views

Cave Setup for Hunting the Wumpus

I am a hobbyist programmer trying to learn modern C++. My son had an assignment in his C++ class to fill in some functions that populate draw the cave in the "hunt for the wumpus" game. When I viewed ...
2
votes
1answer
76 views

Convert char array to number

C++17 have <charconv>. However this header does not work on MacOS - It compiles, but can not link. Same header is not present in ...
11
votes
5answers
3k views

Python's .split() implemented in C

I'm new to the C programming language and I just made a basic version of Python's split() function using C. Note: A major functionality I chose not to implement is ...
1
vote
1answer
38 views

Custom String Formatter

I've written my custom implementation of an f"" / .format(...). I started the project thinking it was going to be longer than ...
9
votes
1answer
264 views

Simplified Linked List Implementation in C++

I'm learning C++, data structures and algorithms and I have implemented a (Doubly) Linked List class for practice. Some STL functionalities are deliberately missing for now (e.g. some functions ...
7
votes
1answer
149 views

base64 encoding and decoding tool

I wanted to understand how base64 encoding (and decoding) works so I implemented this tool in the spirit of "classic UNIX tools" (read from stdin, write to stdout). I'd like to get general feedback ...
6
votes
1answer
66 views

Doubly Linked List using Stack in c++

Just started learning/relearning data structures for the semester exams. Most of the examples found online are too cluttered or bloated. For myself, I implemented it from theory I learned. It works....
2
votes
3answers
152 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
99 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
85 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
169 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 ...
4
votes
3answers
242 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
62 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 ...
2
votes
1answer
259 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
50 views

Bubble sort optimization

This bubble sort code is very slow compared to the original. ...
5
votes
1answer
109 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
186 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 ...
0
votes
3answers
173 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
136 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
117 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
212 views

Portable BrainFuck Interpreter in ANSI C89

I wrote this BrainFuck interpreter in ANSI C89: ...
23
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
81 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
72 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
852 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
159 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
201 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
118 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
254 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
295 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 ...

1 2 3 4 5 16