sarojit049/java

★ 0Forks 0JavaGitHub ↗Compare

README

🚀 Java DSA Practice

This repository contains Java programs for Data Structures & Algorithms (DSA) practice.
Programs are organized day-wise to track daily learning and progress.


📅 Day 1 – Number Basics

1️⃣ Prime Number

  • Checks whether a given number is prime or not
  • Optimized using square root approach
  • Time Complexity: O(√n)

File: PrimeNumber.java


2️⃣ Factorial

  • Calculates the factorial of a given number
  • Implemented using iterative approach
  • Time Complexity: O(n)

File: Factorial.java


📅 Day 2 – String Basics

1️⃣ Reverse String

  • Reverses a given string

File: ReverseString.java


2️⃣ Vowel Count

  • Counts the number of vowels (a, e, i, o, u) in a string

File: VowelCount.java


📅 Day 3 – Number Conversion

1️⃣ Binary to Decimal

  • Converts a binary number (user input) into decimal
  • Implemented using a while loop
  • Avoids Math.pow() for better performance
  • Time Complexity: O(n)

File: BinaryToDecimal.java

📅 Day 4 – Arrays

1️⃣ Find Maximum Element in Array

  • Finds the largest element in an array
  • Introduces arrays, traversal, and comparison
  • Time Complexity: O(n)
  • Space Complexity: O(1)

File: MaxInArray.java

▶️ How to Run the Programs

Compile

javac FileName.java

Contributors

sarojit049

Issues