Ejemplo n.º 1
0
def newAccount(aId, userId, aType, balance):
    '''
    Creates a new account. It's added to the account's hashtable.
    First it searches the user object to assign this new account.
    Then the account is added to the user's maxheap.
    Worst-Case: O(U + A + log(A))
    Average-Case: θ(1)
    '''
    user = getUser(userId)
    account = Nodes.Account(aId, userId, aType, balance)
    user.addAccount(account)
    accountsHash.put(account)
    return account