Pages

Thursday, July 23, 2020

Newbie to Newbie Blog Part Two

In my last post four weeks ago, I shared some advice about how to get up and running for coding with Java. I invited you to review some of the sources I used so you could start practicing. If you didn't have time, I understand, it's a lot of reading and experimenting. I have less hair now but more knowledge about algorithmic design in programming. Once again, I invite you to benefit from my struggles to help you along your way.

As you learn more about the syntax of Java and the concepts of object-oriented programming (OOP) you will appreciate the importance of data structures, and how to choose one over another when solving a problem. At its simplest, a data structure can be a list. If you need that list to be an ordered list it becomes slightly more complex. An even more complex structure would be an array containing arrays. It will be your responsibility as a programmer to choose the best structure for storing and manipulating data.

Every choice you make is a trade-off between time and space complexity. For example, you have a set of data that is accessed frequently by a search algorithm. As the size of the dataset increases, the space it consumes in memory grows, and the time it takes to search it increases. Choosing an implementation of a list that is sequential is better for a large data set because a binary search algorithm can locate values much faster. The trade-off is in the resources it takes to order the list as new elements are added, changed, or removed. The larger the dataset and the more often it is accessed, the greater the benefit of a sequential list.

The best tool for making choices in your design is Big 0 notation. Learn this first, and learn it well. Here is an excellent resource for learning how to apply it in your design choices. After you cognate on that, have a look at this and try some of the exercises to get a good handle on these concepts.