```python
def is_subset_sum(set, n, sum):
    """
    Determines if there is a subset of the given set with a sum equal to the given sum.

    This function uses a dynamic programming approach to solve the subset sum problem.
    It builds a table to store the results of subproblems, avoiding redundant calculations.

    Args:
        set: A list or tuple of non-negative integers.
        n: The number of elements in the set to consider.
        sum: The target sum.

    Returns:
        True if a subset with the given sum exists, False otherwise.
    """
    # The dp_table[i][j] will be True if there is a subset of set[0..j-1]
    # with a sum equal to i.
    dp_table = [[False for _ in range(n + 1)] for _ in range(sum + 1)]

    # A sum of 0 is always possible with an empty subset.
    # This initializes the first row of the dp_table to True.
    for j in range(n + 1):
        dp_table[0][j] = True

    # Fill the rest of the dp_table in a bottom-up manner.
    for current_sum in range(1, sum + 1):
        for num_elements in range(1, n + 1):
            # The current element to consider is at index (num_elements - 1).
            current_element = set[num_elements - 1]

            # First, consider the case where the current element is not included.
            # The result is the same as for the subset with one fewer element.
            dp_table[current_sum][num_elements] = dp_table[current_sum][num_elements - 1]

            # Now, consider including the current element (if its value is not too large).
            if current_sum >= current_element:
                # The result is True if it was already True (by not including the element),
                # OR if we could make the remaining sum with the previous elements.
                dp_table[current_sum][num_elements] = (
                    dp_table[current_sum][num_elements] or
                    dp_table[current_sum - current_element][num_elements - 1]
                )

    # The final answer is in the cell corresponding to the target sum and all n elements.
    return dp_table[sum][n]
```