## Split Words

I have had a stressful week. Glad the weekend arrived. Today I will provide my solution, including the thinking process, to a common and quite popular programming challenge. I have encountered several variations of it. The base problem follows:

“Split a text string into words. Words only contain ASCII letters which for simplicity may be treated as lower (a – z) or upper case (A – Z) characters (developer’s choice)”.

## Fraction Recurring Decimal

For the past few months I had been working attempting to solve a challenge per day on HackerRank. I like that site. A couple weeks ago I was introduced to LeetCode. Challenges seem to be more intense and requirements seem to be vaguer. Knowing this, one needs to think and plan the approach / algorithm with greater care and expect to fail unit tests that one would not think off. I just finished a challenge and decided to post in this blog my approach to solving it. Continue reading “Fraction Recurring Decimal”

## Bag Algorithm

Have to admit it, after a few (will not say how many) years studying Computer Science, architecting and developing systems in multiple programming languages and platforms I had missed the Bag algorithm :o( Gladly I am spending time reading and performing several (do not have time to work on all) exercises and examples in the Algorithms fourth edition book by Robert Sedgewick and Kevin Wayne.

The Bag algorithm is used to implement an object that stores in no particular order items added to it. There is an Application Programming Interface (API) to get the size of the bag and to determine if it is empty. If an Iterator is implemented, then a client is able to iterate in no particular order through the items in a bag. Continue reading “Bag Algorithm”

## Generics Implementation

This blog entry is based on the example on page 141 of Algorithms fourth edition by Robert Sedgewick and Kevin Wayne. I am reading the book as a refresher and learning experience on computer algorithms. Initially what called my attention was the statement that it contains 50 algorithms that every programmer should know. I want to make sure I have a good handle on those algorithms. After reading the first few chapters which have not cover the algorithms yet, I feel that the way the ground work is presented is very educational, direct to the point and simple to follow. I always like simplicity in code and documentation. Elegant code is very hard to find and write. This book seems that it should help readers achieve such goal. Continue reading “Generics Implementation”

## Generics

This blog entry was motivated by the description and implementation of Java Generics in the Algorithms fourth edition book by Robert Sedgewick and Kevin Wayne. The code in this post is based on their implementation. I did some minor changes.

Collections, Generics and Iterators are important concepts in object oriented programming languages. It is central to understand the reasons for them and the associated ideas. If you are interested (and you should if you work with object oriented languages) get a copy of the book and take a look at pages 132 – 141. Continue reading “Generics”

## Evaluate Example – Algorithms Fourth Edition

I am reading, experimenting with the examples and working on some (do not have enough time to address them all) exercises using the Algorithms fourth edition book by Robert Sedgewick and Kevin Wayne. I am having a good time refreshing and learning some new things.

This morning I was reading Dijkstra’s Two-Stack Algorithm for Expression Evaluation on page 129. The algorithm is well explained and works. What called my attention is that the actual code does not seem to work on my machine. I already sent a message to professor Sedgewick for clarification. Continue reading “Evaluate Example – Algorithms Fourth Edition”

## Algorithms – Chapter 1 and 2

I typically write one blog entry per book I read. In this blog, Algorithms Fourth Edition by Robert Sedgewick and Kevin Wayne will be split in comments per one or more chapters.

A few weeks ago I decided to read Algorithms and go over most of the exercises. I wish I would have enough time to tackle them all. This morning I finished reading the first two chapters. So far, so good. Continue reading “Algorithms – Chapter 1 and 2”