Author Archives: victor

Insertion sort php

<?php /** * An unsorted list of integers * Worst case O(n^2) * Best case O(n) * @param array $unsorted */ function insertionSort(array &$unsorted){ for($i = 1; $i < count($unsorted); $i++){ $temp = $unsorted[$i]; $j = $i – 1; while … Continue reading

Posted in algorithms, php | Leave a comment

Calculate the diagonal difference of an N x N matrix

<?php /** * Calculate the diagonal difference of an N x N matrix * * runs in O(n) * * @param int $n size of N x N array * @param array $a N x N array * * @return … Continue reading

Posted in algorithms | Tagged , , | Leave a comment

EBOX (formerly Electronic Box) Internet Service – A review

I am writing this to help out Canadian internet users that might be on, or thinking of signing up Electronic Box/EBOX. Do it – switch. EBOX is an independent Internet Service Provider (ISP) that piggybacks  on the network infrastructure of Bell, Rogers, Videotron, or Cogeco. … Continue reading

Posted in internet | Tagged | Leave a comment

Finding your local African Business in Montreal / Toronto / Calgary – Try Afroll.com

Finding local ethnic establishment is not an easy task. What do I google to find an African business closest to me? Who do I ask? What are the first steps? Non of these are easy answers. You find that most … Continue reading

Posted in Businesses, Tutorials | Leave a comment

The Book Of Not by Tsitsi Dangarembwa – a review

I bought The Book Of Not in 2010. I waited 3 years to read it. The first time I opened the book, I felt overwhelmed with anticipation. I was not sure that if I read the book in between my … Continue reading

Posted in Uncategorized | Leave a comment

Double Ended Queue implementation in Java, and Operations run in O(1) time

public class Main {     /**      * @param args      */     public static void main(String[] args) {     Deque<Integer> Q = new Deque<Integer>(6);     try {         Q.addFirst(3);         System.out.println(Q);         Q.addFirst(5);         System.out.println(Q); … Continue reading

Posted in Code samples | Tagged | Leave a comment

Resursion to add n by n elements in an array

Algorithm   Algorithm sum(A,n)     Input: A, an n by n array     Output: The sum of elements in A       if n=1 then return A[0][0]       s  ← 0     while i < n -1 do         s ← s + A[i][n-1] … Continue reading

Posted in Code samples | Leave a comment

power function in O(n) time, algorithm plus implementation in python

Algorithm number 1.   Algorithm powerOf(x,n)         Input: integer n, non negative integer x         Output : x to the power of n         if n = 0              return 1         m ← 0         while n > 0 … Continue reading

Posted in Code samples | Tagged | Leave a comment

Nonrecursive Factorial Algorithm and Implementation in python

Algorithm fact(n)     input: Nonegative integer n     output: Fibonacci value of n     if n = 0         return 1     m ← 1     k ← 1      while n ≥ k do           m ← … Continue reading

Posted in Uncategorized | Leave a comment

How to translate Shona to English.

Shona to English translation is not easy. So is any translation, because no language is one to one with another language no matter how unrelated or related they are. Shona for one, does not share any roots with English, other … Continue reading

Posted in Uncategorized | Leave a comment