```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 is a classic dynamic programming solution.

    :param set: A list or tuple of non-negative integers.
    :param n: The number of elements in the set to consider.
    :param sum: The target sum.
    :return: True if a subset with the given sum exists, False otherwise.
    """
    # The value of dp[i][j] will be true if there is a
    # subset of set[0..i-1] with sum equal to j
    dp = [[False for j in range(sum + 1)] for i in range(n + 1)]

    # If sum is 0, then answer is true (empty subset)
    for i in range(n + 1):
        dp[i][0] = True

    # If sum is not 0 and set is empty, then answer is false
    # This is already handled by the default False initialization of the table

    # Fill the subset sum table in a bottom-up manner
    for i in range(1, n + 1):
        for j in range(1, sum + 1):
            # If the current element is greater than the sum, it cannot be included
            if set[i - 1] > j:
                dp[i][j] = dp[i - 1][j]
            else:
                # Check if sum can be obtained by either:
                # 1. Not including the current element (dp[i-1][j])
                # 2. Including the current element (dp[i-1][j - set[i-1]])
                dp[i][j] = dp[i - 1][j] or dp[i - 1][j - set[i - 1]]

    return dp[n][sum]
```