Skip to content

max-monty/2d-array-algos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

2D Array Algorithm Practice

A Java project designed to help students practice implementing common 2D array traversal and manipulation algorithms.

Project Description

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:

  1. Finding minimum/maximum values
  2. Calculating sums and averages
  3. Checking for element properties
  4. Counting elements with specific properties
  5. Working with consecutive pairs
  6. Checking for duplicates
  7. Shifting and rotating elements
  8. Reversing rows and columns

Project Structure

The project contains the following key files:

  • src/PatternGrid.java: Main class with method stubs for implementing 2D array algorithms
  • src/SudokuValidator.java: Additional practice with 2D arrays in a Sudoku context

Getting Started

  1. Clone this repository
  2. Open the project in your preferred Java IDE
  3. Start by implementing the TODO methods in PatternGrid.java
  4. Run the main method to test your implementations

Learning Objectives

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

Method Categories

The project includes implementations of these algorithm categories:

  1. Find min/max

    • In entire grid
    • In specific row/column
    • In diagonal
  2. Calculate sum/average

    • Of entire grid
    • Of specific row/column
  3. Property Checking

    • Check if any element has property
    • Check if all elements have property
  4. Element Counting

    • Count elements with specific properties
    • Count elements in rows/columns
  5. Pattern Finding

    • Find consecutive number pairs
    • Check for duplicates
  6. Array Manipulation

    • Shift/rotate elements
    • Reverse rows/columns

Testing

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

Folder Structure

  • src/: Contains the source code files
  • README.md: This file

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages