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
2answers
64 views

Python 3 integer seconds to date-time string convertor

I have written two functions that output a date-time string for any given non-negative integer. The integer is treated as representing total number of seconds in a given time period, the first ...
0
votes
1answer
66 views

Linked List Implementation in C#

I wrote an implementation of the Linked list data structure. I mostly did this because it's the simplest collection data structure (at least the simplest to implement), and I wanted to practice ...
3
votes
4answers
105 views

Improving my implementation of a unique_ptr - PPP Stroustrup book

This question is an improvement of this one here: Implementing a unique_ptr - PPP Stroustrup exercise Here's my new code, following the suggestions by @JDługosz. I agree with the fact that T* ...
0
votes
2answers
41 views

Implementing a unique_ptr - PPP Stroustrup exercise

I'm doing the following exercise from PPP - Bjarne Stroustrup, Chapter 19, ex.10. Implement a simple unique_ptr supporting only a constructor, destructor,...
12
votes
4answers
2k views

Using Python enums to define physical units

I'm using Python's Enum to define the physical units in which a value is expressed. Eventually, I want to add them as an attribute to my ...
1
vote
2answers
40 views

Word frequency finder

Challenge: find the top three most frequently used words in a string. Only imports from the base package are allowed (source: codewars) I'm looking for feedback on (...
1
vote
1answer
53 views

Python 3 arbitrary base converter and base36 encoder

This is a script that can convert any numerical value to any arbitrary radix representation and back, well, technically it can convert a number to any base, but because the output is a string ...
0
votes
1answer
49 views

Writing a buffer that takes a header and a variable number of packets and makes a payload [closed]

I'm writing this as an exercise. I would probably use a vector as a buffer internally (the extra capacity pointer overhead is not important enough). Primarily it's an exercise in writing copy/move ...
1
vote
1answer
100 views

Implementing conditional execution in Python [closed]

I found abandoned project on GitHub and curious is it possible to implement part of it on just Python? Here is most close example of processing I would like to implement: ...
3
votes
1answer
61 views

UNIX calendar(1) in C

This is a simple implementation of the calendar(1) utility included in some UNIX systems (all BSDs have it, GNU has not). I do not have much experience with ...
2
votes
2answers
77 views

An implementation of Uber's “Fare Estimator”

CodeSignal put out a challenge by Uber that involves writing a "fare estimator" that involves a function dependent on cost per minute, cost per mile, ride time and ride distance. The formula ...
4
votes
2answers
1k views

Stack Implementation in JavaScript

I am learning data structures and below is my implementation of a stack in JavaScript. I didn't want to use built in functions for an array because in JavaScript that would be too easy, so I made my ...
3
votes
3answers
146 views

Java OOP Calculator (no GUI)

i have created an object orientated Calculator without GUI. i have provided only the most important parts of the code. I want to add another review question for those parts (especially: ...
1
vote
2answers
121 views

Observer pattern in Rust

A simple implementation of the Observer pattern in rust. The Observable constructor (::new) is called with a subscription function which will be called every time ...
5
votes
6answers
1k views

Implementation of itoa which allocates the string

This is my implementation of itoa() (Integer to Alpha), which converts an integer to a string. Memory management and optimization is important. The caller is not ...
1
vote
1answer
55 views

Hashing Table in Python

I just want your opinion about that code! :) ...
7
votes
2answers
172 views

Two dimensional gaussian image generator in C++

This is a follow-up question for Two dimensional bicubic interpolation implementation in C++ and Two dimensional gaussian image generator in C. Based on user673679's answer, another file ...
2
votes
1answer
82 views

Create a Time class - OOP in Python

Create a Time class. Time is on my side Specification Basic attributes: hour, minute, second and day (default is 0), + getters, + setters (using a decorator) If ...
3
votes
1answer
155 views

Two dimensional bicubic interpolation implementation in C++

This is a follow-up question for Two dimensional bicubic interpolation implementation in C and A recursive_transform Template Function with Unwrap Level for Various Type Arbitrary Nested Iterable ...
9
votes
4answers
2k views

std::list reimplementation

I've decided to rewrite the standard library list in a smaller version. This is similar to another question of mine, where my main concern is memory management. I allocate a new array each time the ...
0
votes
1answer
33 views

SubImage function implementation in C

This is a follow-up question for Two dimensional gaussian image generator in C, Two dimensional bicubic interpolation implementation in C and A SubPlane Method for Generic Two Dimensional Data Plane ...
4
votes
2answers
108 views

Two dimensional bicubic interpolation implementation in C

This is a follow-up question for Two dimensional bicubic interpolation implementation in Matlab and Two dimensional gaussian image generator in C. Besides the Matlab version code, I am attempting to ...
2
votes
0answers
84 views

Two dimensional bicubic interpolation implementation in Matlab

I am attempting to implement two dimensional bicubic interpolation algorithm in Matlab. The input is a two dimensional array and the output is the interpolated result. The test input matrix: ...
3
votes
3answers
84 views

Image Processing Sobel Edge Detection in C

This is a follow-up question for Image Processing Median Filter in C. Under the same tiny bmp image read / write framework, a sobel edge detection function has been performed. The experimental ...
0
votes
1answer
62 views

sorting list using selection sort algorithm

Sorted List value using algorithm selection sort. Can you please review and let me know where I can improve. ...
4
votes
4answers
104 views

Image Processing Median Filter in C

I am attempting to perform Median Filter with size 3 x 3 in C language. The function MedianFilter33 has been implemented as follows. The experimental implementation ...
1
vote
0answers
27 views

Simply Scheme book: "functions.scm", How to use basic language constructs to create interactive prompt for function application

While reading Simply Scheme by Brian Harvey and Matthew Wright: Part I: Chapter 2 Functions In this chapter you are going to use the computer to explore functions, but you are not going to use the ...
3
votes
1answer
47 views

Writing a tail command clone

I'm reading Bruce Molay's book on Unix programming, and as an exercise I've implemented a copy of the tail command. My approach goes over the entire file once, to ...
1
vote
2answers
428 views

Search Method In Python / Python 3.9

I have implemented Binary_Search in python (I think), and my own method for range objects. I want to know if there is any way to improve this code, here it is: <...
2
votes
3answers
170 views

Python binary, decimal, hexadecimal, IPv4, octal converter

This is a Python (3) script that converts numbers among 5 data formats: binary, decimal, hexadecimal and octal, it supports 16 conversions, that is, it can convert each of the five data formats to and ...
2
votes
1answer
44 views

Implementing hash table in Python using Tuples

I am trying to implement a basic hash table using a list of tuples. The code produce the desired output. Please help me improve my code as I feel there are a lot of while loops. ...
6
votes
1answer
325 views

Emulating Python zip() Function

I'm brushing up on Python, working my way through Python Workout. One of the exercises is to emulate the Python zip() function, assuming each iterable passed to the function is of the same length. ...
5
votes
0answers
80 views

Pi Calculator Using BBP (Bailey–Borwein–Plouffe) - Written in Cython With MPFR

I wrote a Pi Calculator using the BBP Algorithm in Cython. My specific goals are make the code more legible and more performant. This is a purely academic script in order to teach me how to implement ...
3
votes
3answers
68 views

Trying for an efficient and readable merge-sort implementation

My first implementation of merge sort in C++. I'm looking for any sort of optimization and/or conventional practice tips, such as using the appropriate data types and naming my variables appropriately....
2
votes
0answers
38 views

producer-consumer Pipeline problem implementation in asyncio

I wrote this code to make a non-blocking manager along with pipeline operations using asyncio, my main concern is to catch received items producer, and when the received operation is complete. I want ...
5
votes
2answers
794 views

Hashmap implementation in C++

I have been asked to implement a HASHMAP in C++ in a job interview (home assignment). I'm a bit unsure about exception safety, but this is what I came up with: Block.h ...
0
votes
1answer
148 views

Encryption/Decryption algorithm #3

This is a follow up question to Encryption/Decryption algorithm #2 and Encryption/Decryption algorithm. In my last question, in @Reinderien's answer, he added this line ...
11
votes
3answers
1k views

A practice shared_ptr implementation

I am trying to build a class similar to std::shared_ptr just to learn and improve my way of thinking. I am hoping that you can tell me if this implementation is ...
1
vote
1answer
60 views

Generating the N-bonacci numbers

I'm new to Haskell, and this is one of the more interesting programs I've made with it so far. I understand there are already solutions to this problem that use much less code, but to me this one ...
2
votes
1answer
115 views

Encryption/Decryption algorithm #2

This is a follow-up question to this one. I have tried to implement all the recommended things in the answers (except commenting, and not being OS specific). Again, if you see anything that needs ...
8
votes
2answers
93 views

Braille Mini-Library in Python

For a small project of mine, I will be needing to work a lot with braille translation. To do that, I have already finished a small program that I can use to translate braille into English letters. To ...
1
vote
3answers
152 views

Value store ("optional" type)

Create a class template named ValueStore that has a member variable, to store a value and a member variable, hasValue that holds ...
4
votes
4answers
292 views

User implementation of memcpy, where to optimize further?

Edit: By adding the restrict keyword I was able to get my memcpy up to speed with the library implementation (and in this particular test, exceeding the library implementations speed). New results: ...
0
votes
1answer
65 views

Sum of fractions

Objective: Create a function to sum a list of fractions (represented as pairs) Rules Only Prelude functions allowed Notes I was debating if I should create a ...
2
votes
2answers
96 views

Generic Object mapping function

I implemented as an exercise a function which maps over object values in Typescript, and I am truly horrified by my type annotations. The function: ...
1
vote
1answer
31 views

"filter" function in Scheme

I know this is a bit elementary, but I am highly uncomfortable writing Scheme code, and I want to make sure that what I'm doing is good practice. I know mutation is frowned upon in Scheme. I have no ...
4
votes
1answer
50 views

Locale-independent float print function

The objective was to write a locale-independent function that prints floating-point numbers (i.e. one that always uses . as a decimal point regardless of the locale)...
2
votes
0answers
103 views

Improving constexpr invoke function C++17, alternative to std::invoke

I've learned that in C++17, std::invoke isn't constexpr. To make a constexpr version, I could copy the implementation provided here: https://en.cppreference.com/w/cpp/utility/functional/invoke , OR I ...
4
votes
1answer
98 views

Python: Matrix Manipulation module

I made a module called "matrix-py" in python to add, subtract, multiply, transpose matrices I want to know how to improve the code quality and if there's something wrong about my code here's ...
2
votes
2answers
124 views

My own function for copying memory in C

I have written a function that copies memory from one destination to another. I would like you to view my code and tell me if I have to fix something. That's the code: ...

1
2 3 4 5
18