Skip to content

Conversation

@haldanek
Copy link
Contributor

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 started with the 6 steps
  • Wrote my logic out, asked/clarified questions and brainstormed
  • What I concluded was that:
    - 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.

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.

2 participants