This repository contains Java programs for Data Structures & Algorithms (DSA) practice.
Programs are organized day-wise to track daily learning and progress.
- Checks whether a given number is prime or not
- Optimized using square root approach
- Time Complexity:
O(√n)
File: PrimeNumber.java
- Calculates the factorial of a given number
- Implemented using iterative approach
- Time Complexity:
O(n)
File: Factorial.java
- Reverses a given string
File: ReverseString.java
- Counts the number of vowels (
a, e, i, o, u) in a string
File: VowelCount.java
- 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
- Finds the largest element in an array
- Introduces arrays, traversal, and comparison
- Time Complexity:
O(n) - Space Complexity:
O(1)
File: MaxInArray.java
javac FileName.java