This repository contains my solution for common algorithms. I've created this repository to learn about algorithms and improve solutions to common computer science problems. I'll try to add more solutions if I have time. :)
Each solution has a Java program and is tested. Some problems contain multiple solutions with different implementations.
You can check the solution executing tests inside tests directory. Some problems were resolved using TDD.
- Binary tree by level
- Binary tree pre order
- Binary tree in order
- Binary tree post order
- Are binary trees equals?
- Is binary search tree
- Binary tree depth
- Lowest common ancestor
- Sorted array to BST
- AVL tree median
- Path calculator
- Path to every leaf
- Is tree balanced
- Generate list with nodes by level
- Reverse linked list
- Remove duplicates
- Find kth element
- Delete list node
- Partition list
- Sum lists
- PalindromeList
- Get element in the middle of the list
- Int to String
- Remove comments from file
- Reverse sentence
- Contains
- Simple regular expression
- Dot regular expression
- Asterisk regular expression
- Unique chars
- Reverse string
- Compress string
- Is rotation using substring
- Is binary number even?
- Sum binary numbers
- Count the number of bits equals to 1
- Merge binary numbers
- Count the number of different bits
- Reverse binary number order
- Reverse binary number
- Square root
- Divide using subtraction
- Multiplication without multiply
- Find sums
- ScientificNotation
- Vector scalar product
- Subtract adding
- Merge sorted arrays
- Split array in positive and negative numbers
- Remove duplicated elements
- Move zeros in array
- Find longest consecutive sequence
- Multiply array elements
- Move elements to position
- Replace spaces
- Rotate matrix
- Rewrite row and columns with zero
- Find the missing number
- Anagrams
- Palindromes
- Are anagrams?
- Constant complexity order stack
- Hello world without semicolon
- Autoboxing trick
- Pedro Vicente Gómez Sánchez - [email protected]
Copyright 2014 Pedro Vicente Gómez Sánchez
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.