CSA Collectibles Prep
Automatically Populated Github Issue
Exploration Outline
Continuing with a new topics… Collectables and Classes FRQ
Team Manager should work with other Team Managers to split up the work across the big teams. This task must be done, but it should not require entire team.
- Prepare 5-10 minute lesson/video
- Prepare 30 minute of hacks
Hacks
Blog or illustrate understanding of the following.
- Watch the college board video Classes and Objects
- 2022 FRQ 2
- Blog and Define the details of a Class: Access modifier, constructor, modifiers/setters, getters, etc.
- Build example code in jupyter notebook with Linked List, Queues, and Stacks.
- Show familiarity with managing data (aka nodes in LL) in these structures.
- Show familiarity with Generic data and ForEach loop support, similar to ArrayLists T. Here is sample Java Generic T and the Java Iterable interface by Geeks4Geeks.
Hacks: Code
- Challenge #1, Add and Delete elements from Queue. Working with the code that is given, you will need to adjust Add and write Delete, to output from the Queue as follows.
Enqueued data: seven Words count: 1, data: seven Enqueued data: slimy Words count: 2, data: seven slimy Enqueued data: snakes Words count: 3, data: seven slimy snakes Enqueued data: sallying Words count: 4, data: seven slimy snakes sallying Enqueued data: slowly Words count: 5, data: seven slimy snakes sallying slowly Enqueued data: slithered Words count: 6, data: seven slimy snakes sallying slowly slithered Enqueued data: southward Words count: 7, data: seven slimy snakes sallying slowly slithered southward Dequeued data: seven Words count: 6, data: slimy snakes sallying slowly slithered southward Dequeued data: slimy Words count: 5, data: snakes sallying slowly slithered southward Dequeued data: snakes Words count: 4, data: sallying slowly slithered southward Dequeued data: sallying Words count: 3, data: slowly slithered southward Dequeued data: slowly Words count: 2, data: slithered southward Dequeued data: slithered Words count: 1, data: southward Dequeued data: southward Words count: 0, data: null
- Challenge #2, perform a merge or combination of 2 Queue’s that are ordered. This is a foundation step for the algorithm used in Merge sorting. IMO, this algorithm is easier if you “peek” at data at the head of the queue, prior to performing dequeue action.
// Start with two ordered Queue's
(1st Queue) 1 -> 4 -> 5 -> 8 -> nil
(2nd Queue) 2 -> 3 -> 6 -> 7 -> nil
// Finish with a 3rd Queue
1 -> 2 -> 3 -> 4 -> 5 -> 6 -> 7 -> 8 nil
- Challenge #3, Shuffle the Queue. Iterate through the Queue and change data with another random position in the queue.
// Start with ordered Queue
1 -> 2 -> 3 -> 4 -> 5 -> 6 -> 7 -> 8 nil
// Finish with shuffled Queue
2 -> 8 -> 6 -> 1 -> 3 -> 4 -> 7 -> 4 nil
- Challenge #4, Build a Stack and use it to reverse the order of a Queue. The Queue is a LIFO Data Structure, the Stack is a FIFO data structure, so code is similar but most everything is reversed.
// Place elements into Queue
(Head) 1 -> 2 -> 3 -> nil
// Print out the following:
1 2 3
// Place elements from Queue to Stack
(Top) 3 -> 2 -> 1 -> nil
// Print out the following:
3 2 1
- Advanced Challenge #5, Implement a Stack from your LL into a new Jupyter Notebook … Here is a former solution