A Java project designed to help students practice implementing common 2D array traversal and manipulation algorithms.
This project provides a structured way to learn and practice standard algorithms for working with 2D arrays (grids). Students implement various methods to perform operations like:
- Finding minimum/maximum values
- Calculating sums and averages
- Checking for element properties
- Counting elements with specific properties
- Working with consecutive pairs
- Checking for duplicates
- Shifting and rotating elements
- Reversing rows and columns
The project contains the following key files:
src/PatternGrid.java: Main class with method stubs for implementing 2D array algorithmssrc/SudokuValidator.java: Additional practice with 2D arrays in a Sudoku context
- Clone this repository
- Open the project in your preferred Java IDE
- Start by implementing the TODO methods in PatternGrid.java
- Run the main method to test your implementations
After completing this project, students should be able to:
- Implement common 2D array traversal patterns
- Understand and apply various array manipulation techniques
- Debug array operations using provided test cases
- Write efficient array processing algorithms
The project includes implementations of these algorithm categories:
-
Find min/max
- In entire grid
- In specific row/column
- In diagonal
-
Calculate sum/average
- Of entire grid
- Of specific row/column
-
Property Checking
- Check if any element has property
- Check if all elements have property
-
Element Counting
- Count elements with specific properties
- Count elements in rows/columns
-
Pattern Finding
- Find consecutive number pairs
- Check for duplicates
-
Array Manipulation
- Shift/rotate elements
- Reverse rows/columns
Each algorithm implementation can be tested using the comprehensive test suite in the main method. The test output clearly shows:
- Initial grid state
- Results of each operation
- Before/after states for manipulation operations
src/: Contains the source code filesREADME.md: This file