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
3
votes
3answers
984 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
114 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
36 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 ...
1
vote
1answer
33 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. ...
1
vote
1answer
94 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 ...
6
votes
5answers
793 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
33 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
42 views

Insertion Sort Implementation Efficiency

Is my approach to insertion Sort in Python efficient? What can be improved efficiency wise? ...
2
votes
1answer
28 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
88 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
97 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
77 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 ...
4
votes
1answer
83 views

A simple printf implementation in C89

I tried to implement printf family functions in C89, after I've read K&R book. The goals are three: Do not use dynamic memory allocation (like ...
0
votes
1answer
47 views

Python extended Euclidean algortihm + inverse modulo

I programmed the extended Euclidean algorithm together with the inverse modulo because I am making an RSA system from scratch. Any feedback regarding efficiency etc. is welcome :) ...
4
votes
4answers
555 views

std::vector implementation C++

I just started studying data structures and being the std::vector the container that I most use in C++ I decide to try to implement it mimicking its behavior the ...
2
votes
1answer
123 views

Modern C++ Linked List

I have been using this quarantine time to learn "Modern C++" (constructs, move semantics, smart pointers, etc, etc) via implementing basic data structures from scratch. As a first step, I've put ...
1
vote
2answers
50 views

Binary exponentation with modulo

I have implemented binary exponentiation. Is this good? ...
3
votes
3answers
115 views

An entire file size retriever using a recursive os function in python

I'm a beginner and i just started with automate the boring stuff with python course and reached his first os lesson, so i decided to make a recursive directory size finder since apparently os.path....
5
votes
3answers
3k views

Bubble sort in Haskell

The following code is part of my practice in implementing algorithms in Haskell. I'm aware that bubble sort is a bad choice for sorting sequences in real applications. ...
3
votes
2answers
112 views

Sorting an array using a Binary Search Tree with C++

Given an array of integer (all different from each other), this program creates a BST with the array elements in order to sort them and put them back into the array, using the BST properties. ...
8
votes
1answer
248 views

C++17 is_integral trait implementation

This is a C++17 is_integral trait implementation. Most implementations exhaust all integral types: bool ...
22
votes
6answers
4k views

Implementing any_of in C++

I've decided to implement Python's any in C++. I've gone about this using templates to allow multiple types of data to be passed, instead of overloading the ...
5
votes
1answer
125 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 ...
2
votes
1answer
1k views

Python binary to decimal converter (without using built-ins)

Any ideas how I could improve this? I already know that there is no checking for anything other than a 1, so you can enter a 2 ...
2
votes
0answers
97 views

Implementation of Doubly Linked List with sentinel in C++ trying to replicate the stl std::list [closed]

I am currently trying to replicate the STL std::list interface with my own list implementation (doubly linked list with sentinel) to learn about all the advanced ...
4
votes
3answers
107 views

C++ Merge Sort Algorithm

I have created this first-timer implementation of Merge Sort and I got confused by the C++ syntax once or twice. So I have some questions about this code: ...
10
votes
3answers
3k 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 ...
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 ...
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: ...
0
votes
2answers
96 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 (...
3
votes
2answers
45 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(), <...
8
votes
1answer
3k views

Java AES-256 GCM file encryption

I wrote my first file encryption program, that encrypts a file with AES-256 GCM and stores IV and salt prepended to the file content, so it's likely that I did something worse than possible. I ...
5
votes
4answers
649 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
43 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 ...
6
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
5k views

C++ Calculator for complex numbers

I've written a little calculator in C++ for complex numbers: ...
2
votes
1answer
75 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 ...
9
votes
1answer
147 views

Quicksort template (for sorting corresponding arrays)

I needed a function for sorting two corresponding arrays. So I wrote this code to sort N corresponding arrays! The really "metaprogrammy" way to do it would be to use ...
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
877 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, ...
16
votes
3answers
68k views

Join List with Separator

I was implementing something similar to Python's join function, where join([a1, a2, ..., aN], separator :: String) returns ...
3
votes
3answers
151 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 ...
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 ...
5
votes
0answers
98 views
8
votes
3answers
6k views

Recreating strstr in C

I'm trying to recreate strstr in c, my code works but I think it is too long, and it needs some improvement. ...
10
votes
6answers
2k 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 ...
4
votes
2answers
122 views

Obfuscation of email and phone using JavaScript

I'm creating a new website, so I am thinking about how to protect my email address and phone number against crawlers, I actually mean email harvesters (most of which I suppose don't have JavaScript ...
0
votes
1answer
78 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: ...
1
vote
1answer
89 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 ...

1
2 3 4 5
16