Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sockets - Pauline #31

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Sockets - Pauline #31

wants to merge 1 commit into from

Conversation

paulentine
Copy link

No description provided.

Copy link

@CheezItMan CheezItMan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work, this is an optimal solution. The if statement lets you from a practical standpoint minimize memory usage, as you make a smaller hash.

@@ -1,6 +1,24 @@
# Returns a new array to that contains elements in the intersection of the two input arrays
# Time complexity: ?
# Space complexity: ?
# Time complexity: O(n) to hash in, O(m) to look up, where n is length of array1 and m is length of array 2

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would characterize this as O(n + m) where n is the length array1 and m is the length of array2, since you have to loop through each array once.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants