Question

In a double-entry accounting system, every business transaction has to be entered as two

separate transactions, in different two accounts, once as a debit and once as a credit. For

example, if a business borrows $10,000 from a bank, the business should enter a debit of

$10,000 to its Cash account and a credit of $10,000 to its notes Payable account. In order to be

in balance, every debit in such a system must have a matching credit.

Describe an efficient algorithm to test if a double-entry accounting system is in balance. What is

the running time of your method in terms of n, the number of business transactions?