Encapsulation is binding the data and behaviors together in a single unit. The data is not accessed directly but accessed through the exposed functions. We create private methods to prevent other classes from accessing it.
Docker is an open source software to develop, deploy and run applications using containers. Docker containers are lightweight and are easily scalable. They can also be deployed anywhere such as on physical and virtual machines as well as the cloud.
In selection sort, we are going to iterate through the elements in the array starting at
i = 0. We are going to assume that the element at
i has the lowest value and set
i to the variable
indexOfMin. We are going create an inner
for loop to iterate from
i + 1 to the end of the array to see if there is an element with a lower value. If there is, we would update the value of
indexOfMin. After we get to the last element in the inner loop, we see if the index of the current element and
indexOfMin is the same. If they are not, we swap them.
I will be going over an interview question on how to implement a queue using two stacks. For example, if we push “a”, “b”, “c” to a stack, and we want to implement a queue, we call the dequeue method three times to have the elements come out in the order of “a”, “b”, “c”.
Given an integer N, return a N x N spiral matrix.