In this project, popular algorithms will be implemented. Also necessary data structures which will be used in that algorithms will be implemented. Java language used in implementations. Current progress is below.
- List (com.omeraytekin.data_structures.List)
List is an interface which includes necessary methods for list operations (eg. insert, delete, search). It extends Iterable interface which is in java.lang API. Thus this interface ensures that list items can be iterate over forEach.- ArrayList (com.omeraytekin.data_structures.ArrayList)
First implementation of list is by using dynamic array. In dynamic array there is an initial sized array. When this array is full, new bigger array will be created. This new array size will be old array size multiplied by grow factor. After creating new array all elements of old array will be moved to new array.
Note: When grow factor is between 1 and 2 and array size is small, it can cause multiplying and flooring array size and grow factor is equal to old array size. To prevent this situation, after multiplying and flooring array size and grow factor, It'll be increased by 1.
To create ArrayList object there is 4 ways.
- Using default constructor: By using default constructor, initial array size will be 32 and grow factor will be 2.
List<Integer> list = new ArrayList<>();
- Using initial size constructor: By using initial size constructor, initial array size will be given value and grow factor will be 2.
List<Integer> list = new ArrayList<>(32);
- Using initial size and grow factor constructor: By using initial size constructor, initial array size and grow factor will be given value
List<Integer> list = new ArrayList<>(32, 1.5);
- Using existing array constructor: By using existing array constructor, initial array size will be given array size and grow factor will be 2
Integer[] items = {1,2,3,4,5}; List<Integer> list = new ArrayList<>(items);
- LinkedList (com.omeraytekin.data_structures.LinkedList)
[TBA]
- ArrayList (com.omeraytekin.data_structures.ArrayList)
- Stack (com.omeraytekin.data_structures.Stack)
[TBA]- ArrayStack (com.omeraytekin.data_structures.ArrayStack)
[TBA] - LinkedListStack (com.omeraytekin.data_structures.LinkedListStack)
[TBA]
- ArrayStack (com.omeraytekin.data_structures.ArrayStack)