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
1answer
508 views

An intrusive chained Hash Table

I was interested in experimenting with some intrusive versions of common data structures, so I've written this simple chained hash-table using the approach: ...
-1
votes
1answer
45 views

Human Readable filesizes

I am re-inventing the wheel and would like to lay down a comprehensive filesizes function. The only issue is that I guess bit-wise operators are more efficient but I'll be darned if I can understand ...
4
votes
3answers
546 views

Thread safe cache for write through and writeback

This cache is like a list where new elements are inserted in the middle, cache hits are put to head of the list and replaced elements are taken from the end. Would I just use a list the lookup would ...
2
votes
2answers
3k views

Fraction Class in Python

I decided to train myself in OOP with a simple perfect precision Fraction class. ...
4
votes
0answers
269 views

C++ vector implementation errors

I haven't really programmed in C++ for about a year, and realised that I should get back into it, and tried my abilities out by remaking the STD vector class. However, my C++ is a bit rusty at the ...
4
votes
1answer
249 views

Stack with Array

Just coded up a simple Stack using an Array in Java for practice. Other than the lack of JavaDoc (still need to learn that part), did I cover all the bases? ...
12
votes
1answer
17k views

malloc(), free(), realloc() using brk() and sbrk()

I recoded malloc() by using brk() and sbrk(). I just want some "reviews" to see if it is ...
5
votes
1answer
9k views

Better implementation of Gaussian Elimination

I made an algorithm in C# that solves any system of linear equations using the Gaussian elimination. There are 2 text boxes in the program for input and output. Input is in the format of the ...
6
votes
2answers
8k views

Basic String class

I wanted to create a basic String class that will hold a CString and have: constructor, destructor, copy constructor ...
2
votes
2answers
1k views

Tail Recursive Fibonacci

Please critique my implementation of a tail-recursive method for generating the Fibonacci sequence: ...
2
votes
2answers
269 views

Quicksort algorithm

I have reimplemented the quicksort algorithms that takes a list and sorts it in non-decreasing order: ...
13
votes
1answer
6k views

Graph implementation adjacency list 2.0

Version 1: Graph implementation adjacency list 1.0 Please note the following: All edges are directed A user of the class Graph shall never be able to aces an object of type ...
2
votes
2answers
181 views

List.containsSlice

In an effort to strengthen my functional programming, I'm reading Functional Programming in Scala. One of the assignments is to implement a function that does the same operation as ...
23
votes
8answers
5k views

Optimize custom double.parse()

In my company's code, they use double.tryParse() which is quite good but sets too much security for our needs. As we sometimes have to parse a few billion strings, ...
7
votes
1answer
3k views

Implementing a C++11 raw string class

I'm trying to implement a RawString class that conforms to C++11: ...
4
votes
1answer
121 views

Reversing the “words” of a container with a bidirectional iterator

I posted another snippet of code a few weeks back when I started learning C++. Here's my second try now that I have some time to play with this again. The goal is to write a generic algorithm for ...
4
votes
2answers
335 views

Implementation of a quicksort function

I am an absolute beginner to programming and am learning it using C. I have just learned function pointers and tried to implement a quicksort function using function pointers to determine the nature ...
2
votes
2answers
372 views

Implementing `sequenceA`

I implemented sequenceA: ...
2
votes
1answer
104 views

Pointer handle - absolute follow-up

This is a follow-up to: Pointer handle - follow-up Pointer class/handle Please review my pointer class. ...
4
votes
2answers
95 views

Pointer handle - follow-up

This is a followup to: Pointer class/handle Please review this pointer class. ...
2
votes
1answer
95 views

Pointer class/handle

Please review my pointer class. ...
4
votes
1answer
1k views

Vector implementation

This is a C++ Vector that I've made for the pleasure of it. It was made on a whim and is not related any school assignment or anything alike this. This Vector does ...
1
vote
1answer
774 views

Prime Number Sieve Optimization

I've written my own prime number sieve in JavaScript. It loops through numbers 1-100 and puts them in one of two arrays, depending on if it is composite or prime. I was wondering if there are any ...
6
votes
1answer
80 views

Pointer handle - only allocates in stack

This is a pointer class of mine that I would like to have reviewed. Right now it only allocates in the stack and has no copy or move operations. ...
2
votes
2answers
612 views

Yet another smart pointer implementation for learning

I based this implementation on CountedPtr in The C++ Standard Library book by Nicolai Josuttis (page 222) and also available online here. I know that I can use the C++11 smart pointers but this is a ...
1
vote
2answers
16k views

Effective way to remove white spaces from string

I have come up with this approach but I'm not convinced about its effectiveness. Is there any effective approach? ...
3
votes
1answer
4k views

Simulation of bus route

Theme of my course work in institute is simulation of bus route. Could you determine any faults and defects in this code? I will be very grateful if you give me some advice about one global variable, ...
3
votes
2answers
3k views

Make a dict class from scratch in Python

Here's the API my teacher assigned: and here is what I came up with: ...
8
votes
1answer
276 views

Markdown to HTML, again

I made another markdown parser. (original, this one on github). Look, I'm not crazy (sorta), I just like making markdown parsers… ...
11
votes
1answer
1k views

Minimal C++ Unit Test Framework

I've written a minimal unit test framework. The goal was to allow assertions of booleans, for equality and catched exceptions. Two things are bugging the most. That assertions have to rely on macros ...
4
votes
3answers
938 views

Implementation of arbitrary-precision integer addition

Implementation: ...
6
votes
2answers
5k views

Queue implementation without using built-in data structures

In an effort to brush up my algorithms and data structure skills I have a done a queue implementation without using built in data structures, i.e. using only arrays. Any comments on this code ...
17
votes
2answers
4k views

It's Friday! - Zeller's Congruence Revisited

A couple of date-related questions have come up recently, and on both occasions I have been taken back to my 'early' days where one of my first forays in to programming involved implementing Zeller's ...
5
votes
4answers
2k views

Binary search tree

This is a binary tree using classes. What can be improved upon? ClassTree.h ...
4
votes
1answer
707 views

Create `suffixes` Function on List

I wrote the following suffixes function. Given a list, it returns the list + all sub-lists. suffixes [1,2,3,4] == [[1,2,3,4], [2,3,4], [3,4], [4], []] Please ...
2
votes
2answers
417 views

Implementing Function that Maps over Stream

I implemented the following function: the ruler function 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, . . . where the nth element in the stream (assuming the first element corresponds to n = 1) is ...
5
votes
1answer
84 views

Convert an `int` to a C string with size limitation

Creating a textual version of an int to save as a C string to a buffer that is all ready allocated and maximum allowable size is determined seems common. Thought I'...
2
votes
1answer
356 views

O(n) Fibonacci?

I attempted to write an \$O(N)\$ Fibonacci. ...
1
vote
1answer
1k views

Converting integers to strings

I drafted a method that I intend to use to convert integers to strings. Is there a way to make it faster? Are there any "simple" changes I could make to improve its performance? This cannot be done ...
3
votes
1answer
365 views

FoldLeft in Terms of FoldRight

I [believe that I] wrote foldl in terms of foldr: ...
10
votes
2answers
745 views

Smart but simple pointers

For practice, I've implemented my own smart pointer class. It's a 'unique pointer', meaning it doesn't allow copies of itself (when copying from a into ...
4
votes
2answers
2k views

Unsafe Stack in C#

I was interested to see if it was possible to implement an unsafe stack in C#, so I wrote this: ...
12
votes
2answers
2k views

Templated doubly-linked-list

I've been wanting to revise what I knew on templated classes so thought I'd write a doubly linked list to practice. It works fine, so all is well and good on that front, but is there something I've ...
4
votes
2answers
2k views

Implementing faster StringBuilder that only works with ASCII strings

I wrote a StringBuilder that works only with ASCII strings. the current append performance is almost identical to BCL StringBuilder append performance. I want some tips on how to make it faster, and ...
5
votes
2answers
3k views

Parsing command line arguments in Perl

I use this idiom to parse command line arguments in Perl: ...
1
vote
0answers
37 views

Small Map library written in Haskell

I wrote the following Map "library", and would like general feedback. It's my first major use of Binary Trees, so if I'm doing anything dangerous, I'd like to know. Specifically, I "brute-forced" the ...
5
votes
1answer
1k views

Python implementation of multidimensional power spectral density with Welch method

I have done my best to write Welch method implementation for python for multidimensional time series and still in the case of one dimensional time series I am getting inconsistent response compared to ...
5
votes
4answers
272 views

C library that converts integers to string and vice-versa

I've created this little library to help ease myself (and for others, hopefully) with the pain of having to convert integers to string and vice-versa. It's written in C, and for maximum portability I ...
4
votes
1answer
366 views

Small pre-C++11 pseudo-random library

Some time ago (pre-C++11) I wrote a small random number generator library as part of a university assignment. The code has been stored on my hard drive for quite some time and today I dug it out and ...
8
votes
1answer
739 views

PubSub and two-way data binding

I looked up how to use the PubSub pattern in JS and came across a few articles. I wanted to have two way data binding, so when a one of an Object's Properties value was set, it would update x number ...