Ceaser cipher and other things

Today, I was browing again in the textbook and for some reason I wanted to implement a simple Ceaser cipher. In the process, I also re-found-out that Strings are immutable in java. I suppose it makes sense then when StringBuilder and the such are used. I also found the following two statements interesting: … that characters are represented in Unicode by integer code points … … upper letters of the Latin alphabet are consecutive (for simplicity … and you know what? No one has ever connected these two ideas together like that or pointed it out. I’ve used these exact ideas before and never considered how fortunate that everything just works (= Why — duh — A is obviously 65 and B is 66. Anywho, I wanted to implement this shifting algorithm and this is how far we got: import...

Continue Reading →

Unless otherwise mentioned in the post, those projects are side projects which I work on on weekends and evenings, and are not affiliated with my work or employer.

Tags: software engineering, computer science, algorithms   |   Report a bug via Twitter

Insertion Sort

Question: Suppose you have an algorithm that you are running that has multiple steps. When you are approximating, when do you add the runtimes and when do you multiply them? if do this, then when you are done with this, do that, then you add runtimes if do this for each time you do that, then you multiply runtimes The Insertion-Sort Algorithm The goal of this algorithm is simple: take an array of elements and sort it in an increasing order. It does so by inserting one element at a time and by comparing elements during insertion. Algorithm InsertionSort(A): Input: An array A of n comparable elements Output: The array A with elements rearranged in nondecreasing order We basically walk one element at a time, from 0 to n: for k from 1 to n do Insert element A[k] at...

Continue Reading →

Unless otherwise mentioned in the post, those projects are side projects which I work on on weekends and evenings, and are not affiliated with my work or employer.

Tags: software engineering, computer science, algorithms   |   Report a bug via Twitter

Relationships between sets, series, progressions, and sequences

Today I ended up exploring a topic that I didn’t expect: what is the difference between a sequence and a series. While I memorized these contepts in my calculus days, I always felt something was missing in my core understanding. I think I figured out what was missing. It seems that I was confused, once again, around the ambiguity of the English language. I stumbled upon the following in one of my favourite textbooks: A numeric progression is a sequence of numbers, where each number depends on one or more of the previous numbers. followed by arithmetic progression determines the next number by adding a fixed constant to the previous value and geometric progression determines the next number by multiplying the previous value by a fixed constant which made me go Aha. All I had to do was check if...

Continue Reading →

Unless otherwise mentioned in the post, those projects are side projects which I work on on weekends and evenings, and are not affiliated with my work or employer.

Tags: software engineering, algorithms, math, calculus, sequence, series, progression   |   Report a bug via Twitter

Trying out Aho–Corasick algorithm

Today I found Aho–Corasick algorithm. I was instantly hooked on wanting to try it out. Since I am spending more time with Java, most of the day was spent playing with an implementation of this algorithm and maven. I will tell you what, I was pleasantly surprised so far. I need to spend some more time on this but it looks like a promising solution. I wanted to use something like this on the elderoost project. So, here is what my MVP looks like so far. For this problem I wanted to use a large piece of text as input. For example, I was reading the news earlier and I found a good candidate. I used the following news article as my input: Ontario has promised to add 15,000 new long-term care beds across of the province in the next...

Continue Reading →

Unless otherwise mentioned in the post, those projects are side projects which I work on on weekends and evenings, and are not affiliated with my work or employer.

Tags: software engineering, algorithms   |   Report a bug via Twitter