Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nikhil-jindal12/recursive-iterative
Recursive and iterative methods that keep in mind the big-O time complexity.
https://github.com/nikhil-jindal12/recursive-iterative
big-o-notation java-8 javadoc-documentation recursion
Last synced: 9 days ago
JSON representation
Recursive and iterative methods that keep in mind the big-O time complexity.
- Host: GitHub
- URL: https://github.com/nikhil-jindal12/recursive-iterative
- Owner: nikhil-jindal12
- Created: 2023-09-13T19:42:47.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-09-26T00:39:15.000Z (over 1 year ago)
- Last Synced: 2024-11-13T04:13:28.387Z (2 months ago)
- Topics: big-o-notation, java-8, javadoc-documentation, recursion
- Language: Java
- Homepage: https://nikhil-jindal12.github.io/Recursive-Iterative/
- Size: 24.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Recursive-Iterative
This program uses both iterative and recursive approaches to implement the following:
- `palindromeIterative` & `palindromeRecursive`: Check if a string is a palindrome
- This method is written using both iterative and recursive approaches, however, only the iterative method is called in the implementation
- `anagramChecker`: Check if two strings are anagrams
- `addSubstring`: Adding a substring into a string at a given index
- `getLength`: Returning the length of a string
- `occurrenceCounter`: Counting the number of times a substring is in another string
- `sentenceReversal`: Reversing the order of the words in a sentence
---------------------
Each method was written while keeping the big-O time complexity in mind. The big-O time complexity for each of the methods is as follows:
- `palindromeIterative` - O(n)
- `palindromeRecursive` - O(n)
- `anagramChecker` - O(n^2)
- `addSubstring` - O(n)
- `getLength` - O(1)
- `occurrenceCounter` - O(n * m)
- `sentenceReversal` - O(n)
---------------------
When running the Java file, the program should continuously run while presenting the user with an option menu upon startup. The option menu prints out the options of the functions mentioned above, and also a quit option that can be used to stop the program. When first starting up, the option menu looks like this:
Welcome to the App
1. Palindrome Check
2. Anagram Check
3. Add Substring
4. Get Length
5. Count Occurrences
6. Reverse Sentence
7. QuitChoose an Option: