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
4
votes
1answer
94 views

Yet another doubly linked list

This is a working but very simple doubly linked list. I wrote it to get more familiar with certain language concepts and because I've never made one in C++. (For convenience reasons this is not split ...
4
votes
1answer
2k views

Moving objects on a grid in C++

I have a code that works but is very badly written. The main is very verbose, it is just to test the class. I want to make objects move on a chessboard (a coordinate grid). I've defined these object ...
5
votes
1answer
78 views

A minimal wc for stdin

This is a minimal reimplemtation of wc. It supports only stdin at the moment and no command line arguments, that's for a later version. This is my first complete ...
4
votes
1answer
145 views

Button click logic with SFML

I wrote some functionality that works as intended in order to create functional clickable rectangles. I inherit from RectangleShape in SFML and I have several objects (not just buttons) that inherit ...
5
votes
3answers
369 views

Self-made string class

Since I've been working with C strings these days, I decided to make a string class from the ground-up just to see how it would go. I wrote all labels in Spanish (my mother language) just for the sake ...
5
votes
2answers
146 views

Queue Implementation in C++ [closed]

When reviewing my code, please consider these questions too: Any way to avoid using new/delete? Or are data structures like that normally and can't really use smart pointers? I was thinking of using ...
5
votes
1answer
197 views

Binary Search Tree C++

Appreciate your thoughts and feedback... BST.h ...
3
votes
0answers
72 views

Huffman encoding in Rust

An implementation of Huffman encoding / decoding as a learning exercise. I'm still new to Rust, so any tips about making things more natural for the language are appreciated. ...
2
votes
1answer
368 views

operations with complex numbers in C++

...
11
votes
5answers
4k views

Stopwatch class

I am learning C# and I have an exercise: Design a class called Stopwatch. The job of this class is to simulate a stopwatch. It should provide two methods: Start and Stop. We call the start ...
14
votes
3answers
1k views

Stack Implementation in C++ with Exceptions

Appreciate your thoughts and feedback... Stack.h ...
0
votes
2answers
116 views

C++ Stack implementation with linked-list

It's proving difficult to find implementations of a Stack with linked list and Im trying to figure out if my implementation is correct/not missing anything obvious. ...
1
vote
0answers
227 views

Permutation of a given set

A simple aspect of brute forcing certain problems is that you may have to do a large numbers of tasks in large numbers of possible orders, as such an algorithm for calculating all these possible ...
1
vote
2answers
626 views

Simple String class with operators

Any input is appreciated! And can I get some advice on how to properly delete the dynamically allocated memory with the destructor? My professor said we have to delete each individual element of an ...
10
votes
2answers
4k views

Yet another implementation of malloc() in C

I'm really curious to know someone else's opinion on this implementation. Specifically, I would be interested to know the way you would have implemented it. Here the list of issues I've found with in ...
4
votes
3answers
236 views

Find substrings in string

I'm self-learning C now, and I want to find out if my code is good and clean or kinda messy. For this exercise, the program tells if the text which was inserted has the keyword "asd", without using ...
5
votes
1answer
1k views

C++ RSA Implementation

A while ago I wrote an implementation of RSA with C++, that takes in a simple string,encrypts and then decrypts it. It's pretty much the only substantial thing I have written in C++ and while it works ...
3
votes
1answer
342 views

C# basic dictionary (hash) implementation

I have implemented a very basic hash data structure with basic set/retrieve methods. A good example of use of this implementation would be a phone-book. I have used as underneath storage structure an ...
1
vote
1answer
64 views

Object formatter using reflection

I am making an object formatter for use when debugging. Formatted class: ...
4
votes
1answer
181 views

Two-way data binding

Why reinvent the wheel? I personally like to implement all of my JS from scratch, I try to stay away from using the likes of jQuery or any external sources/libraries/frameworks as much as possible. ...
13
votes
1answer
202 views

Logging library

Due to several limitations of the standard library's logging module, I wrote my own. Below are the most important parts. You can find the whole library here. Any feedback is welcome. ...
7
votes
2answers
2k views

Echo implemented in Java

I implemented a simple version of echo(1) command utility. The program works as described in the man page: it writes to the standard output all command line arguments, separated by a whitespace and ...
28
votes
5answers
4k views

C++ Vector Clone

I'm learning C++, so I decided to make a simpler clone of std::vector. Concerns: I have seen people defining methods outside of the class, and only prototyping ...
10
votes
1answer
1k views

Merge n sorted iterators

Over the weekend I was curious about efficiently merging multiple sorted iterators together, and for them to be in sorted order. This is quite like a challenge on HackerRank: You’re given the ...
1
vote
1answer
79 views

Fortune of Unix V7 implemented in Java

I'm learning Java recently, this is one of my first program written in this language. I reimplemented a basic version of Fortune. This version prints to the standard output a randomly chosen line ...
4
votes
2answers
413 views

Custom maximumBy and minimumBy in Haskell

Going through the magnificent Haskell Programming from first principles, I'm currently reimplementing functions from standard libraries such as maximumBy and ...
2
votes
1answer
311 views

Optimisation suggestions for Min Heap

Can someone please optimisations for my implementation of min heap.Its performance is poor compared to the heapq module in python. My use case for the MinHeap class is 'N' insertions and extractions ...
2
votes
1answer
406 views

Home-grown encryption/decryption function

I know what you are thinking, it's never a good idea to roll your own encryption functions, but I'm doing this for fun and self-learning. I created a function that allows you to send a string as a ...
2
votes
3answers
114 views

Quick sort with a predicate

I want to pass a predicate into quick sort. The issue I'm running into is that the predicate must have two arguments, the pivot and the element of the list's tail. As far as I know though, predicates ...
0
votes
1answer
1k views

Generate a set of combinations

For one of my personal projects, I needed an algorithm to generate a set of combinations. I've finally successfully written one. The problem is that this algorithm uses two recursive calls to ...
2
votes
1answer
274 views

StopWatch for users C#

I have tried to create a stopwatch and I have done but I don't know how to improve it, and I want the user control the stopwatch whether it (Start) or (Stop), I'll be thankful if you tell me what I ...
2
votes
1answer
58 views

Stack implementation in python using jupyter

This is my first program in Python: a stack implementation. ...
6
votes
2answers
155 views

Permutations II from leetcode solution

Given a collection of numbers that might contain duplicates, return all possible unique permutations. For example, [1,1,2] have the following unique permutations: [[1,1,2], [1,2,1], [2,1,1]] ...
5
votes
2answers
2k views

Recursive sorting algorithm

I wrote a recursive sorting algorithm and was wondering what would be the run time complexity of this. The bulk of the work is done in the push_up function, which I ...
10
votes
2answers
2k views

Heap allocated std::array

I have created a heap allocated equivalent of std::array simply because I needed a lightweight fixed-size container that isn't known at compile time. Neither ...
2
votes
1answer
40 views

C - non-recursive mergesort on lists

Continuing my foray into classic structures and algorithms, I've tried to implement merge sort for doubly-linked lists. From my (limited) testing it seems the thing I've concocted works, but several ...
6
votes
2answers
105 views

is_subset Python implementation

I wanted to ask for a code review for my implementation of Set: ...
6
votes
0answers
303 views

C - fully threaded binary search trees

For learning purposes, I've decided to implement several classic data structures, starting with binary search trees. The entire code can be seen here, in a frozen branch ...
4
votes
1answer
735 views

Basic Implementation of Hash Table in Python

Basic impl of hash_table in python. Supports set, get, and delete. Uses open addressing with linear probing function. Any ideas would be greatly appreciated! Thanks! ...
10
votes
1answer
8k views

Self-contained SHA-256 implementation in C

I have been looking for a SHA-256 implementation in C with no dependencies (preferably self-contained in a single C-file) with a permissive license but found none to my liking. Since the Wikipedia ...
5
votes
1answer
117 views

iterative binary_search Python implementation

I did a Python implementation of binary search implementation iteratively. It passes all of the test and I was wondering if I can get any feedback. ...
3
votes
1answer
642 views

Python Hash Table and insertion

I'm attempting to implement a basic hash table in Python using linked lists. Any tips would be appreciated (including better hash functions). I intend this to handle collisions with separate chaining. ...
5
votes
3answers
1k views

Binary Search Tree BFS iteratively

I was given this coding question for a technical interview: Given a binary tree, implement a method to populate the list level_ordered_list with the data of the nodes traversed level-order, ...
3
votes
3answers
167 views

A “templated” doubly-linked list implementation in plain C

I've attempted to make something similar to C++ and D templated lists in plain C. In this gist there's the full code of the header file and test driver I'm using. I'll post some excerpts from the ...
0
votes
2answers
418 views

Python generate custom combinations of sub lists

I'm generating a custom combination of sub lists without using itertools. Here's what I've come up with: ...
2
votes
1answer
105 views

Python implementation for Set

I wanted to ask for a code review for my implementation of Set: ...
2
votes
1answer
107 views

DoublyLinkedList python implementation and unit testing

I wanted to ask for code review for DoublyLinkedList. Especially my insert, find, replace, <...
5
votes
1answer
959 views

Base conversion: decode and encode base to integer

I encountered this question as I am preparing for my code interview. I was implementing a base function that can decode and encode any bases from base 2 to base 36. I think my ...
9
votes
3answers
739 views

indexOf Boyer-Moore String Search algorithm

This is an implementation of Boyer-Moore string search algorithm index_of for a pattern in text. I was challenged to implement it by my friend. This Python ...
3
votes
2answers
80 views

Python implementation for contains pattern in text

This is an implementation of contains, which returns a boolean indicating whether a pattern occurs in text. I encountered this question while I was implementing ...