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

### Advertisement

### Categories

Handy snippets of code

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

Posted in C# Also tagged buffer, c#, compression, decompression, deflate, development, gzip, GZipStream, MemoryStream, programming, UTF8Encoding Leave a comment

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 [...]

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 c++, cpp, development, equation, gauss, linear algebra, math, programming Leave a comment

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 biginteger, c#, c-sharp, cryptography, development, fermat, fermat's little theorem, math, miller-rabin, primality, primality test, prime, prime numbers, programming, public-key cryptography, random, rsa 2 Comments

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 c, development, dijkstra, graph, OSPF, programming, shortest path Leave a comment

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 c#, c-sharp, compression, development, huffman coding, huffman tree, lossless, Net, programming 11 Comments

The Heapsort algorithm implemented in C++

Binary Search Tree (BST) implementation in C++

Posted in C++ Also tagged binary search tree, binary tree, BST, c++, development, programming, tree Leave a comment

The bubble sort algorithm implemented in JavaScript

Posted in JavaScript Also tagged bubble sort, development, javascript, programming, sorting Leave a comment