Q:

Figure out Big O of this Minimum Coin Greedy Algorthm

static void coin(int[] d, int amount) {
        int num_coin;
        for (int i = d.length - 1; i >= 0; i--) {
            num_coin = amount / d[i];
            System.out.println("You should give " + num_coin + " coins of denomination " + d[i]);
            amount = amount % d[i];
        }
    }

Depending what I send this algorthim, would that change the Big O of it? Meaning, if I send in a 1 with the total amount of 1, it would run O(1) time, right? If I send in {1} with a total of 5, would that be O(5) or O(n)?
If I sent in {1,4,16,64} looking for a total of 55, would that be O(n) still? n being the total in the array

A:

Arithmetic Operation (+, -, /, *) have a O(1)
You are looping over the int array d, which produces a complexity of O(items in loop)
Assuming n are the number of items in int array d, then the final Big O of this algorithm can be written as, O( N + 1 + 1) = O(n)
To address your question, you will not be affecting the complexity of this algorithm based on the value of amount, all that would matter is the number of time the loop runs, which in this case is not fixed (ie not constant)

