0% found this document useful (0 votes)
2 views5 pages

Java HRD Est Patterns

Uploaded by

ingitghosh845
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views5 pages

Java HRD Est Patterns

Uploaded by

ingitghosh845
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

🧩 1.

Hollow Butterfly Pattern

Shape: Looks like two triangles joined at the middle, with hollow spaces.

* *

** **

** **

* ** *

* ** *

** **

** **

* *

Concept:

 Two mirrored halves (left and right wings).

 Needs precise space and star control using nested loops.

🔺 2. Hollow Pyramid Inside a Solid Pyramid

**

* *

* *

*********

Key Idea:

 Outer pyramid full of *

 Inner hollow pyramid using conditions:

 if (k == 1 || k == i || i == n)

🔹 3. Diamond of Numbers (Palindromic)

121

12321

1234321

123454321
1234321

12321

121

Challenge:

 Two mirrored number pyramids

 Palindromic pattern within each line.

🌀 4. Spiral Matrix Pattern (Advanced)

For n=5:

1 2 3 4 5

16 17 18 19 6

15 24 25 20 7

14 23 22 21 8

13 12 11 10 9

Difficulty:

 You need loop boundaries that move inward.

 Hardest part: changing direction and reducing range dynamically.

⚙️5. Pascal’s Triangle Centered

1 1

1 2 1

1 3 3 1

1 4 6 4 1

Trick:

 Nested loops for space and numbers.

 Numbers calculated using nCr (combinations):

 int num = 1;

 num = num * (i - k) / k;
🧠 6. Concentric Square Number Pattern

For n = 4:

4444444

4333334

4322234

4321234

4322234

4333334

4444444

Trick:

Use:

int min = [Link]([Link](i, j), [Link](n*2 - i, n*2 - j));

[Link](n - min + 1 + " ");

Perfect nested logic + math combination.

🔶 7. Hourglass or Sandglass Star Pattern

*********

*******

*****

***

***

*****

*******

*********

Concept:

 Combine inverted and upright pyramids.

🧭 8. Hollow Diamond with Diagonals

**
* *

* * *

* * *

* * *

* *

**

Trick:

Handle both diagonals with:

if (j == mid - i || j == mid + i || j == mid - (n - i) || j == mid + (n - i))

💀 9. Chessboard Cross Pattern (Complex)

XOXOXOXO

OXOXOXOX

XOXOXOXO

OXOXOXOX

XOXOXOXO

OXOXOXOX

XOXOXOXO

OXOXOXOX

Challenge:

Alternate between X and O using:

if ((i + j) % 2 == 0)

🌐 10. 3D Cube Illusion (Star Box)

*******

* *

* *** *

****

* *** *

* *
*******

You might also like