Posts tagged Algorithms

A better implementation of bead-sort

0

Introduction

Bead sort (a.k.a Abacus sort, or Gravity sort) is a sorting algorithm that can sort a list of positive integers.
Belonging to a class of natural algorithms, It uses (/simulates) gravity to sort an input list.

The sort algorithm accomplishes this in three acts –

 

Figure 1: Illustration of abacus sort for an input list [2,6,1,4,3]

(more…)

Combinatorial Algorithms

0

Combinatorial algorithms(permutations, combinations, powersets, subsets et, al) had never been my forte.

Infact, I was quite scared of them.
Presumably an irrational fear that stuck with after a failed effort in my graduate years.

No matter, This weekend, I set out to remedy that.
I didn’t want to read on the algorithms before implementing and decided I’d go pencil-and-paper and implement one that occurs naturally to me.

Here goes the result of that –

(more…)

Go to Top