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
5
votes
2answers
59 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 ...
2
votes
1answer
38 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
0answers
37 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
98 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
428 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
1answer
755 views

Simulate object.__getattribute__ in Python

I want a Python example that illustrates how object.__getattribute__ resolves instance attribute lookups. I'm looking for feedback about the following code. Is it ...
6
votes
2answers
330 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
938 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 ...
6
votes
2answers
149 views

Command line arguments adhering Posix and GNU standards

The following code extracts command line parameters and modifies argc and argv parameters of the. After all parameters are read ...
3
votes
2answers
88 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
47 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
53 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
588 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
118 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 ...
6
votes
0answers
133 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 ...
3
votes
1answer
293 views

C++ program that processes unique markup language similar to HTML

I have solved a task which takes input in a unique markup language. In this language each element consists of a starting and closing tag. Only starting tags can have attributes. Each attribute has a ...
8
votes
2answers
60 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 ...
2
votes
3answers
66 views

Perl - Splitting a string

I've decided to work on my Perl skills. I've written a small subroutine that splits a string based on an optional delimiter. I'd like any feedback on this program so I can kick bad habits to the curb. ...
3
votes
1answer
54 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 <...
5
votes
2answers
3k views

C++ Arraylist Implementation

I am a new C++ developer who, coming from Java, am having issues in understanding some of C++'s key memory management features. Below is my attempt at an ArrayList implementation and I would really ...
9
votes
3answers
944 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 ...
6
votes
0answers
168 views

Character-based transitions (part of a lexer)

As part of my prep for the Code Review community-challenge (which looks like it will be Write your own programming language), I've been working on an LL(1) lexer generator in Rust. Yes, lexer ...
9
votes
2answers
1k views

Simple square root calculator

Very simple square root calculator. I am sure it's terrible and can be made much better. I feel it's way too many lines. ...
8
votes
3answers
790 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. ...
19
votes
4answers
71k views

Join List with Separator

I was implementing something similar to Python's join function, where join([a1, a2, ..., aN], separator :: String) returns ...
4
votes
1answer
161 views

std::vector remake

Out of the majority of my c++ projects, the most used thing is std::vector because it allows me to not have to my own memory management. However previously I had never really thought much about how ...
3
votes
2answers
796 views

Custom Thread Pool - Reusing non-busy threads

This is an exercise in thread pooling in which I attempt (hopefully in a successful manner) to reuse existing threads (much like Java's own ...
2
votes
1answer
75 views

JavaScript — Convert decimal to another base

The Source code is maintained on GitHub and may be cloned via the following commands. A Live demo is hosted online, thanks to GitHub Pages. ...
3
votes
2answers
76 views

Script to generate random password

I made this random password script. It works, but i think it is kind of bloated. The part where random characters are being added is the area where I think it needs work. I don't want to declare if ...
5
votes
1answer
134 views

Getting a transpose of a matrix of size of n*n where n=2^m using multithreading

The following is a c++ source code to get a matrix (std::vector<std::vector<T>>) transpose in parallel. The span is \$\Theta(\lg^2(n))\$ while the work ...
5
votes
4answers
21k views

Implementation of std::map

I have decided to make a basic C++ implementation of the std::map class, and I was checking that it is fine, as I am not sure if the ...
3
votes
1answer
2k views

Implementing my own Integer.toBinaryString(int n) method

Our senior developer gave us (trainees/jr. developers) a small exercise and that is to make our own Integer.toBinaryString(int n) implementation. This is the answer ...
5
votes
1answer
1k views

Python PBKDF2 using core modules

I'm trying to implement pbkdf2 in Python 2.7/3.4 without needing the pbkdf2 module. (I'm also trying to avoid using classes.) Any insight would be appreciated: ...
13
votes
5answers
23k views

Python Hash Table Implementation

I'm attempting to implement a basic hash table in Python using only lists. Any tips would be appreciated (including better hash functions). I intend this to handle collisions with separate chaining. ...
4
votes
2answers
104 views

Program to convert number from any base to decimal

I have made a script to convert number from any base to decimal. I am trying to optimize the code because I think it is bloated and can be improved but if I change anything it affects error handling ...
3
votes
1answer
59 views

JSON Data-structure in C++ and querying it

As a personal challenge I want to implement a C++ JSON Parser. As part of that I have implemented the following Types/Data-structures and a way of querying them. To represent the type of an individual ...
6
votes
1answer
604 views

Custom Big Integer class for Project Euler in C#

I'm trying to teach myself some programming and, working through the Project Euler problems, I've come across some instances where I've needed numbers that are larger than will fit into an int or long ...
3
votes
3answers
1k views

Regex version of strip() - Ch. 7 Automate the Boring Stuff

Here is a practice exercise — Regex version of strip() \$-\$ Write a function that takes a string and does the same thing as the ...
5
votes
2answers
120 views

Implementing parser combinators in a functional manner

I am just starting on my journey of learning clojure (I have just read to the end of chapter 3 in clojure for the brave and true). So for practice, I wrote some parser combinator functions. I am quite ...
2
votes
0answers
39 views

Doubly linked ring implementation

I was practicing C++ and data structures and wrote my own implementation of a doubly linked ring. I would love to improve my code a little bit more and would need help from the community. Here is the ...
2
votes
1answer
126 views

Generating all variations of M*N matrix containing boolean values

I've implemented an algorithm that generates all variations of a matrix of size \$M*N\$. My approach is that I see a matrix as a list where the position of elements can be calculated from the position ...
5
votes
2answers
6k views

HMAC-SHA1 implementation

I am trying out a small piece of code that would generate HMAC-SHA1. I have been asked to code the HMAC implementation myself using the OpenSSL libs for SHA1 calculation. After 'wiki'ing for the ...
5
votes
5answers
835 views

Convert Integer to String without using Java API library

I have written a Java program that converts an integer to String digit by digit and concatenate them together using the + operator without touching the Stock Java API library. I like to have feedback ...
2
votes
1answer
37 views

Merge Sort Implementation Efficiency In Python

I wasn't able to find a standardized source for a working example of Merge Sort. Each learning site had a slightly different take on the algorithm implementation, disregarding the bottom-top ...
3
votes
1answer
44 views

Insertion Sort Implementation Efficiency

Is my approach to insertion Sort in Python efficient? What can be improved efficiency wise? ...
2
votes
1answer
34 views

Re-implementing an Array Class in Python

I gave an attempt at reinventing the wheel and recreate list methods using my own Array Class to broaden my understanding about lists. I would like advice regarding efficiency, and in implementing ...
5
votes
1answer
94 views

An echo program, mostly in C and completely from scratch

This is an echo program with no runtime or standard library. It's meant to be compiled with -nostdlib on an amd64 Linux system. ...
2
votes
1answer
99 views

Preserving principle of locality while performing memory allocation

In order to implement an efficient AST visitor preserving the principle of locality, I implemented some reference counting mechanism in C++ with the following set of features: All the newly allocated ...
3
votes
1answer
79 views

Implementing Linked Lists in Python as a beginner

I have been learning linked lists for the past three days. I feel I have implemented a complete linked list. Are there any more things a linked list should do? Please can you review any or all of my ...

1
2 3 4 5
16