In coding languages, Reverse Polish Notation is used to calculate math expressions by using Stacks and the Shunting-yard algorithm to parse through the inputed data
Ex: 6 * 15 becomes 6 15 *
Operators are stored in a hash map based off of order of operations - which ones come first and thus take precedence
private final Map OPERATORS = new HashMap<>();
{
// Map<"token", precedence>
OPERATORS.put("*", 3);
OPERATORS.put("/", 3);
OPERATORS.put("%", 3);
OPERATORS.put("+", 4);
OPERATORS.put("-", 4);
}
Queues are a type of data structure in which elements are inserted at the end of a queue and removed from the beginning - first in first out
Stacks are a type of data structure in which elements are inserted at the beginning of a queue and removed from the beginning - first in last out
Queue.add(1)
Queue.add(2)
Queue.delete()
Result: {2}
Stack.add(1)
Stack.add(2)
Stack.delete()
Result: {1}
Data Structures are a method of organizing data - variables, sequences, and databases are all data structures. Data structures and algorithms work well together to create otpimized and efficient code.
Impaerative paradigms use statements to change a program's state. Object Oriented Paradigms use objects and classes.