Data structures

(3 articles)

Design Patterns

(4 articles)

Contests of code

(1 articles)

"The state design pattern allows for full encapsulation of an unlimited number of states on a context for easy maintenance and flexibility."

It is used in scenarios where application needs to create a number of instances of a class, which has almost same state or differs very little.

Provide an interface for creating dependent objects without specifying their concrete classes.

The Binary Search Tree is a data structure that store "items" (such as numbers, names etc.) in memory. 

It is based on TreeMap, the main different is that TreeSet is an implementation of Set interface and TreeMap on Map interface.

This kind of collection sorts your entries just when they are inserted. No need to call sort().

Recently, I participate in the awesome coding contest The Accountant in CodinGames. This contest was a 2-week optimization challenge, where it was not necessary to succeed all of the given test cases to have a good score. Unfortunately, I didn't use the 2 week because I was travelling. I only used 5 days.

It was my second time in this kind of contests, and I finished in the position 1774/6214 ( you can see the report in The Accountant report for my user cguzman ). Not so bad for a second time :)

I am not an expert in Genetic Algorithm (GA), but I decided to implement one for this solution. Thus, now I will explain how was my approach for this challenged.

The Trie is an ordered tree data structure used usually to store strings, in which case each node defines an association with a letter of the alphabet. Unlike a binary search tree, no node in the tree stores the key associated with that node; instead, its position in the tree defines the key with which it is associated.

Builder pattern is an alternative way to construct complex objects and should be used only when the increase of object constructor parameter combination leads to an exponential list of constructors. Instead of using numerous constructors, the builder pattern uses another object, a builder, that receives each initialization parameter step by step and then returns the resulting constructed object at once.