BairesDev-CodingExam

Code generated for BairesDev Coding Exam

For question 1 please refer to FactorialCalculator.java class

Stack data structure was used as asked. It was used to store factorials of previous numbers until we reached the one we were looking for. This data structure also provides useful methods such as push, peek and pop. Please refert to FactorialCalculatorTest.java for Unit testing.

For question 2 please refer to OperatorQueue.java class

LinkedList data structure, implementing Queue interface was chosen for this question as it maintains FIFO order and has queue required behavior methods such as add, peek and poll. Please refer to OperatorQueueTest.java for Unit Testing

For question 3 please refer to ProfessionMap.java class

Since we needed a data structure based on a key and a value, Map data structure is the best option to solve this question. Please refer to ProfessionMap.java for Unit Testing

For question 4 please refer to ListsExercise.java class

For this exercise we need a data structure capable of traverse elements in an efficient way. List and ListIterator can help us to solve this question.

Unit tests should be run with maven.

Second link:

Exercise 1

Implement a method that, given a number, calculates the factorial of that number. The method implementation must use a stack data structure.

Exercise 2

Implement a class that represents people waiting in line to talk to a line operator. Use the best data structure for implementation, specifying which one you picked.

Exercise 3

Given the following table of Names - Professions, implement a class that allows me to get the profession of a person using his name. Use the best possible data structure for the implementation.

Exercise 4

Given two lists of numbers: