iiitv / algos

Popular Algorithms and Data Structures implemented in popular languages
MIT License
1.07k stars 495 forks source link

Update DepthFirstTraversal.java #873

Closed sanvi-05 closed 9 months ago

sanvi-05 commented 9 months ago

Input validation has been added for both the dfs method to check if the vertex is within the valid range and the initEdges method to ensure that the number of vertices is greater than 0. If the input is invalid, it throws an IllegalArgumentException with an appropriate error message.

Fixes #{ISSUE_NUMBER}

By submitting this pull request I confirm I've read and complied with the below declarations.

raj-j-shah commented 9 months ago

@sanvi-05 Please refrain from sending pull requests directly. You must first be assigned to a task, after which your pull request will be reviewed and, if approved, merged.