# Java: Artificial Intelligence; Made Easy, w/ Java Programming; Learn to Create your * Problem Solving * Algorithms! TODAY! w/ Machine Learning & Data Structures, 1st Edition (2015)

### Chapter 1. Algorithms: The Essentials

==== ==== ==== ==== ====

In essence, how an AI agent will contemplate, process, rationalize, apply logic, & ultimately generate solutions will mainly be through the use of algorithms.

If you’re new to programming, don’t be intimidated. An algorithm is essentially a procedure to handle data. As long as you understand how a certain algorithm processes its data, you’ll be fine.

**Algorithm Traits**

First, you’ll want your algorithms to satisfy four key factors:

- Completeness

- Optimization

- Time Complexity

- Space Complexity

Now we’ll go through each of these and explain them all. Afterwards, you’ll explore some algorithm ideas and determine how they fit in to each of these factors.

**Completeness**

If an algorithm is guaranteed to find at least one existing solution or conclusion within a certain time frame, we can say that an algorithm is complete.

**Optimization**

If an algorithm finds a solution and guarantees that it is the optimal one, then that algorithm is considered optimal.

**Time Complexity**

For an algorithm, this is an expression for the longest possible time it will take to complete. In other words, the worst-case scenario when it runs and finds a suitable solution.

**Space Complexity**

This expression is similar to Time Complexity, but instead it represents the maximum amount of memory the algorithm may use in order to find a solution. This is also considered the worst-case scenario.

**Your Ideal Algorithm**

After discussing the traits your algorithm can have, you’ll get an idea in what to look for when creating an AI algorithm. You want to design yours to find at least one solution (completeness), and the best solution it can create given data it has (optimization) while using up as little computational effort as you can (Time & Space Complexity)