feat: adds Kimberlee's Lesson 12: Data Structures: Stacks, Queue, Linked Lists #438
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I am sorry for the long introduction to my pull request, however, I need to explain how my code ended up looking the way it does. First, I misunderstood the assignment and thought we were solving one problem three different ways (lesson 12, ListNode, Stack). I'm not sure how I came to that conclusion.
Lesson12.java Thought Process:
- I need to create a function with an even, 0-indexed list of unknown length,
- the head must be clearly identified,
- the nodes in the list must be set to teams even and odd,
- nodes must be called up in pairs,
- the function must iterate through the list incrementing by pairs and each pair's value is compared,
- the node team with the higher value gets added to the list,
- the function returns the name of the team with the most higher values as the winner
It sounds like a lot (because it is) but that is how I worked it out in my mind and this is why my original code has "TeamNode" instead of "ListNode".
ListNode.java Thought Process:
I was initially confused as I was working on this file. It looked almost exactly the same as my lesson12.java file without an ArrayList. It wasn't until Joseph explained that I had misunderstood how to complete the assignment that I realized where I went wrong. I left the code but I commented it out just to show what I was thinking and what I did.
Stack.java Thought Process:
When I misunderstood the assignment I agonized on how to complete this file. I again used the 6 steps, specifically asking questions. One of the questions I asked was what the function should do if there was nothing in the stack. I used ChatGPT and it gave me the "isEmpty" and "RunTimeException".
Overall, after going through my code and talking out the process with Joseph, I have a better understanding of the assignment and where I went wrong. I did have trouble with the gradle testing, my build failed every time it ran.