Tag Archives: algorithm

GZip compression and decompression in C#

The snippets below illustrate GZip compression and decompression using the GZipStream classes.

Posted in C# | Also tagged , , , , , , , , , , | Leave a comment

(Java) Quicksort in Java, with Enforced Suckitude

It’s no fun implementing QuickSort unless you can force it out of its blister-fast, O(n log n) speed and humiliate it with its worst-case, O(n^2) runtime. So that’s what I set out to do. My naive partition simply pivots around the low item, but my randomized partition defeats the sucky inputs by choosing a random [...]

Posted in Java | Also tagged , , , , , | Leave a comment

(C++) Gaussian Elimination

Numerical Methods application for solving system of equation using Gaussian Elimination based on this Wikipedia article: http://en.wikipedia.org/wiki/Gaussian_elimination

Posted in C++ | Also tagged , , , , , , , | Leave a comment

Primality testing with Fermat’s little theorem and Miller-Rabin in C#

Prime numbers have many applications. For example, in cryptography. The RSA algorithm for public-key cryptography uses large prime numbers for generating keys. Quote: The RSA algorithm works as follows: take two large primes, p and q, and compute their product n = pq; n is called the modulus. Choose a number, e, less than n [...]

Posted in C# | Also tagged , , , , , , , , , , , , , , , , | 2 Comments

(C) Dijkstra’s Shortest Path algorithm

Its Dijkstra’s Shortest Path algorithm written in C. Reads from a file the nodes and the connected edges and implements Dijkstra’s algorithm. I am uploading for your comments in my code. Thank you. Files content should be in the format: n N startNode endNode distance startNode endNode distance . . . startNode endNode distance where [...]

Posted in C | Also tagged , , , , , , | Leave a comment

(C++) linked_list class (both the header file and the template file)

This is a linked list that can be used like an array where instead of using [] after the reference you just used .get() (and some other methods) but now you don’t have to worry about sizing. For example, with an array you would do: cout

Posted in C++ | Also tagged , , , , , | Leave a comment

Huffman coding in C#

Huffman coding is an encoding algorithm used for data compression. So called Huffman trees are used for encoding and decoding of data. The leaves of these trees contain the symbols and their frequencies. Each parent node contains the sum of the frequencies of its children.

Posted in C# | Also tagged , , , , , , , , | 11 Comments

(C++) [CISP 430] Heapsort

  The Heapsort algorithm implemented in C++

Posted in C++ | Also tagged , , , , , | Leave a comment

(C++) [CISP 430] Binary Search Tree

Binary Search Tree (BST) implementation in C++

Posted in C++ | Also tagged , , , , , , | Leave a comment

(JavaScript) bubble sort

The bubble sort algorithm implemented in JavaScript

Posted in JavaScript | Also tagged , , , , | Leave a comment