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
0
votes
0answers
17 views

initialize 2d array using 12 tone algorithm with Rust

a rust exercise in initalizing a 12x12 array based on the algorithm for twelve tone matrix described here: https://www.instructables.com/Create-a-Twelve-Tone-melody-with-a-Twelve-Tone-Mat/ i copy ...
1
vote
0answers
18 views

gpuIncreaseOne Function Implementation in CUDA

I am trying to perform the basic operations + with CUDA for GPU computation. The function vectorIncreaseOne is the instance for ...
2
votes
1answer
68 views

Pulse-width modulation module

Module for generating a PWM signal. The req_value_i input gets a duration value of the signal. Furthermore, the module can be stopped by deassertion of the enable_i input. ...
1
vote
1answer
56 views

Snake game in C++17 with SDL2

I implemented a simple snake clone in C++, using SDL2 for the graphics part. Gameplay-wise, its pretty much classic snake: The player is able to control the snake with "WASD", food gets ...
1
vote
1answer
50 views

Company database REPL program in Rust for Chapter 8 of The Book

Using a hash map and vectors, create a text interface to allow a user to add employee names to a department in a company. For example, “Add Sally to Engineering” or “Add Amir to Sales.” Then let the ...
7
votes
2answers
151 views

Idiomatic use of `Option` and `unwrap` in mean, median and mode Rust program for Chapter 8 of The Book

I've recently finished Chapter 8 of The Book and have started doing the exercises at the end of the chapter. This post pertains to the first exercise which involves writing a program to output the ...
3
votes
3answers
139 views

A simplified regular expression matcher

I am working my way through some code challenges — partly to improve my problem solving, but also to improve my code quality. I think my current (fully-functional) solution to a challenge is pretty ...
0
votes
1answer
72 views

Generic Meyers Singleton implementation in C++

Is this a correct implementation of a generic Meyers Singleton in C++17? Any tips appreciated. Singleton.h ...
0
votes
0answers
35 views

Convert hex to base64 and then fixed XOR

I've seen on the site questions where too simple tasks can be grouped into one. Here are Challenge 1 & 2 from Crypto Challenge Set 1 in Python. Any suggestions? ...
2
votes
2answers
62 views

A postfix (a.k.a. Reverse-Polish Notation - RPN) calculator

As an exercise, I put together a postfix calculator using modern Fortran. Language apart, I am interested in knowing your take on the algorithm. As far as I remember from my freshman year (chemistry - ...
4
votes
2answers
79 views

Implementing dynamic array without STL

For my game engine that I'm trying to write without using STL I implemented dynamic array class(some kind of std::vector). I would like to know whether this code suits best practices. I'm also not ...
6
votes
3answers
147 views

Beginner C fgetline() implementation

I am doing C coding practice by reinventing a getline function that works with any streams. Any comments on the overall code quality, including correctness, style ...
1
vote
2answers
139 views

C++ Shared_Ptr implementation

I reinvented a c++ smart pointer, shared_ptr to be precise. It is meant for practice purpose and does not attempt to replace the standard implementation. To the ...
2
votes
1answer
60 views

An Implementation of Two Dimensional Plane as Monochromic Image Container with std::unique_ptr in C++

I am trying to implement a monochromic image container with std::unique_ptr. The example usages The example usages is as below. ...
6
votes
1answer
140 views

Parsing a JSON one line at a time in Python

happy 2021 everyone! I started coding some months ago for fun and recently I challenged myself to build a JSON parser in Python (v3.8). The basic idea was to avoid loading the whole file at once, ...
2
votes
2answers
50 views

Unsigned integer power with overflow detection

An unsigned integer version of pow() is fairly easy to code, yet I also wanted: overflow detection portability only modest performance impact due to overflow ...
3
votes
1answer
66 views

PHP JWT management base library for inclusion in larger projects

Edit: this is a base library for including in larger projects for the overall management of JSON Web Tokens (JWT) that should be compatible with other JWT libraries that share an encryption secret - ...
3
votes
2answers
187 views

My String Class

Here's my very basic String class. This is my first attempt, to try to design and write a basic String class in C++, without using the absolute new features provided by newer C++. ...
7
votes
2answers
148 views

AES implementation in python

For educational purposes, I have implemented the AES block cipher in python. I decided to follow the interface for block cipher modules as defined in PEP 272. The implementation consists of two python ...
2
votes
3answers
294 views

A Merge Sort implementation for efficiency

This is my version of mergesort. ...
2
votes
1answer
84 views

C++: swapping bytes of an uint64_t

This question is about swapping bytes of an uint64_t value, or in other words, about converting between endianness of an integer value: ...
2
votes
1answer
77 views

C++ implementation of a Stack with dynamic C-style array

I implemented a Stack in C++ using a dynamic C-style array. I tried sticking to the most important functions a Stack has to have to be usable. This is meant to only be for integers. I appreciate any ...
4
votes
0answers
96 views

Sorting Algorithm (from scratch) in Python

Updated (at the bottom) I am attempting to write a Python program where I have to create a sorting algorithm without the assistance of the built-ins (like the sort()...
5
votes
1answer
62 views

Matrix template Class

This is my 2nd shot at dynamic memory allocation. This project is for practice purposes. So many things were considered whilst writing this minimal project. I considered using placement new to ...
7
votes
2answers
325 views

Doubly Linked List Data Structure ADT in C++

I'm trying to implement a Doubly Linked List data structure in C++. Please give me suggestions on how this code can be improved. Try to remain in C++11 because that's what I know atm. ...
6
votes
2answers
239 views

Custom STL Vector container Implementation

For practice purposes, I reimplemented a STL Vector container. This container has most/all of the capabilities of STL vector.In my previous post, the reviewers made critical and concised observations ...
3
votes
2answers
132 views

Linked List Queue Implementation

I implemented a Queue using linked list data structure. This is also my first time using templates in C++. OVERVIEW Queue is a data-structure that supports only ...
7
votes
3answers
1k views

Implementation of Singly Linked List (C++)

I tried to implement a singly linked list myself, sorry it is not commented but I think it should be pretty self-explanatory, if not feel free to comment. I know that using namespace std; is not ...
4
votes
4answers
323 views

Convert Integer to Binary String

This code takes a user input number which is a positive integer, and outputs a string representation of the number in binary. For example, input 2 outputs ...
11
votes
3answers
374 views

FASTA-to-tsv conversion script

I worked on a script that takes as input a multi-sequence .fasta file and outputs the number of each aminoacid/sequence in a .tsv...
5
votes
1answer
157 views

AJAX with Vanilla Node.js/JavaScript – POST JSON without a form

I am new to node.js, ajax, and asynchronous code. I’ve pieced together a working way to exchange json between browser and server and am wondering if someone with more experience considers the approach ...
2
votes
1answer
76 views

Print exact value represented by float in [0,1)

Motivated by yet another floating point question on stackoverflow, I decided to print a float value \$x\in[0,1)\$, i.e., the fractional part of a float (I might try printing whole floats later). But ...
2
votes
1answer
65 views

Converting an integer to a hexadecimal string representation in Java

I have rolled my own Java method for converting ints to the hexadecimal Strings: ...
5
votes
2answers
102 views

Complex Numbers & Unit Tests in Python

I've just started a course that will require knowledge and experience with Python for future projects, which I don't have, so I thought I'd give it a go to familiarize myself with it and get some ...
5
votes
0answers
47 views

Sequence and Series Calculator

The Sequences & Series involved are Arithmetic and Geometric. stores and allows you to calculate using these given formulas and import fractions into micropython Support for micropython! ...
1
vote
2answers
116 views

a simple implementation of unix2dos for windows

On linux there is the utility called unix2dos which converts UNIX EOLs(\n) to DOS EOLs(\r\n). However on windows there is no such tool so as a result I decided to make one. ...
4
votes
3answers
466 views

String class implementation

I'm working on a project (it's a language), and for that project, I decided to go with a low-level C++ style, so that means making my own data types. I recently got done making my own string class ...
6
votes
2answers
356 views

Quadratic Expression Factorer and Solver

I have decided to create a program that can factor and solve quadratic expressions in micropython, where the standard library is limited, and i have no idea how to implement external modules onto it, ...
11
votes
1answer
1k views

C++ : B-Tree in C++20 (+Iterator support)

I wrote a B-Tree implementation in C++20, based on my previous Red-Black Tree implementation. Unit Test Demo : https://wandbox.org/permlink/Brw6TgAhdy89OIyj Any feedback will be welcomed! ...
9
votes
2answers
1k views

C Implementation of atof

I'm a beginner at C. I'm currently implementing atof to build a raytracer, however I'm still learning how to efficiently write programs. Assignement Instructions The program takes a scene description ...
3
votes
2answers
94 views

Binary to Decimal conversion program

I am a beginner in Python and I have written a program to convert binary numbers to decimal. It works, but are there any ways to improve the code and make it better? ...
5
votes
1answer
52 views

Dynamic-sized Hash table with Linked List

Below is an implementation heavily based on climberig's implementation on Leetcode for LeetCode 706. Design HashMap. Just to preface, I am doing this in preparation for an exam. The one below is ...
6
votes
1answer
59 views

Buffered and unbuffered cat(1) implementation

I reimplemented cat(1) for fun. I followed the Open Group Base Specifications (Issue 7, 2018 edition), not the GNU variant and its command line arguments. Buffered ...
7
votes
2answers
715 views

This python code converts integers to strings and strings to ints without the inbuilt functions “int()” and “str()”

It is my solution from a challange from edabit.com named "Drunken Python". Thats the task: You need to create two functions to substitute str() and int(). A function called int_to_str() that ...
4
votes
1answer
211 views

Doubly-linked list with iterators

Writing a double-linked list seemed like a good practice for understanding it. I tried to fix all the errors that were pointed out to me in the last question, as well as add new functionality. In ...
7
votes
0answers
157 views

c++ std::function implementation

When I first tried to implement std::function I thought it would as easy as creating a class that holds a function pointer. Consequently, I quickly figured out that ...
8
votes
2answers
63 views

Line wrapping text utility using fixed-size arrays

As an exercise, I've made a text processing utility that wraps arbitrarily long lines of text, but only using fixed-size arrays and other basic C features. I have mostly programmed in Python, C++ and ...
3
votes
1answer
74 views

creating own javascript join and push methods

I'm a newbie trying to write my own push() and join(). This isn't very serious, just an exercise. This is what I got so far <...
9
votes
3answers
996 views

DynamicArray class in C++

I am pretty new to C++ and I think I have some problems of keeping code clean and optimized, especially I have problems with writing comments. I just don't know when should I be explaining what I ...
8
votes
3answers
817 views

Optimizing a linked list

I wrote a linked list class and don't know how to optimize it, please suggest some ideas for optimizing and fixing possible memory leaks. ...

1
2 3 4 5
17