Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- While(x not found in S) {
- // Find the value of the difference or S2
- int difference = x - S[Element]
- // if the difference is < 0 this would mean that
- // the element is greater than x
- // and thus S1 + S2 != x
- if (difference < 0)
- Discard
- else {
- // Firstly check if S[Element] == to Difference in Hash Table
- // If S[Element] == Key in Hash then that would mean Hash.Key.Value + S[Element] == x
- if (S[Element] is a key in Hash Table)
- return S1 = S[Element] & S2 = Hash.Key(S[Element]).Value
- // We insert it into the hash table if it does not already exist
- // Difference is not a key in the Hash Table
- else
- Insert into hash table (Key == Difference, Value = S[Element]
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement