-
Notifications
You must be signed in to change notification settings - Fork 19
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
Jeffrey 4 #997
base: master
Are you sure you want to change the base?
Jeffrey 4 #997
Conversation
Give a more detailed description with how the interview question works and left comments in the code to explain the parts of the code.
Made a checkpoint for the leetcode question card
Added a general definition for the time complexity
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
explanations could be clearer
# cards_folder | ||
curriculum/Data-Structures-and-Algos-Topic/Module1-Intro-to-Data-Structures-and-Algos/Activity2_HashTables/checkpoints/ | ||
|
||
# instruction |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- punctuation. it can be a period.
- you can say: "find and explain the runtime of...."
The idea on how to approach this problem is to define the appropriate mapping of each character in your string based on it's index. | ||
This would skip repeated characters in the string to improve the run time of this algorithm. This would result of a time complexity of | ||
O(n), a space complexity for the Hashmap of O(min(m,n)), and a space complexity for the table of O(m) * m. | ||
The solution uses extra space to store the last indexes of already visited characters. The idea is to scan the string from left to right, keep track of the maximum length Non-Repeating Character Substring (NRCS) seen so far. Let the maximum length be max_len. When we traverse the string, we also keep track of the length of the current NRCS using cur_len variable. For every new character, we look for it in already processed part of the string (A temp array called visited[] is used for this purpose). If it is not present, then we increase the cur_len by 1. If present, then there are two cases: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- typo; "indices"
- formatting: please use
when mentioning code snippets
(ex:cur_len
). in fact all variable names, method calls, etc not in code blocks should be formatted in code snippets with the `(tick marks).
Input: "abcabcbb" | ||
Output: 3 | ||
Explanation: The answer is "abc", with the length of 3. | ||
Input: "ABDEFGABEF" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't seen the previous cards yet, but the explanation of the solution (lines 14-19) are not very clearly explained. It glosses over a lot of the why's. consider:
- why do we store the indices of the last visited characters in addition to the length? is it important to keep track of when we eventually return the answer?
- you never explicitly mention that you are essentially breaking the string into 2 parts (visited and not-visited). this can be confusing
- what is the purpose of the sentence "Let the maximum length be max_len"? is this some variable that we first set when we start? will it be continually updated to store the new maximum NRCSs?
O(n), a space complexity for the Hashmap of O(min(m,n)), and a space complexity for the table of O(m) * m. | ||
The solution uses extra space to store the last indexes of already visited characters. The idea is to scan the string from left to right, keep track of the maximum length Non-Repeating Character Substring (NRCS) seen so far. Let the maximum length be max_len. When we traverse the string, we also keep track of the length of the current NRCS using cur_len variable. For every new character, we look for it in already processed part of the string (A temp array called visited[] is used for this purpose). If it is not present, then we increase the cur_len by 1. If present, then there are two cases: | ||
|
||
The previous instance of character is not part of current NRCS (The NRCS which is under process). In this case, we need to simply increase cur_len by 1. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add some more transition so the delineation between the 2 cases are clear
@JeffTheAggie now that I have more or less scanned the rest of the activity, your breakdown and explanation of the leetcode activity doe snot address using hash tables or dictionaries at all. Which inherently is a problem. In addition, you should follow proper "leetcode breakdown" format, in which you want to break the complex problem into easier subproblems (a layer or 2) so that in the end everything comes together. also add big O analyses for time and space for your leetcode activity. |
This was under the hashtables portion from the leetcode page. I'll try to look for a better example from the website. |
you don't have to completely redo it. just explain the use of the hash table better (in more detail) |
Added more logistical explanations that would explain the concept behind the LeetCode question and tied back to its importance to hashtables.
Reworded instruction for checkpoint
@mxthu313 I implemented the changes that you wanted me to add for this activity. I explained the logistics behind the purpose of the leetcode interview question and also tied it back to its relation to hashtables. I also reworded the instruction for the checkpoint question. |
Label
Epic
Issues Closed
Closes #971
...
Changes proposed in this pull request:
Gave a more in depth explanation regarding the interview question card by describing the functions in the code and added more detail to explain the time complexity.
Made an additional checkpoint that tests the student if they can explain the time complexity sufficiently.
@kavuong and @sarahg500