This structure uses simple array to store generic elements. You can create list with specified size of use default. When array will be filled add another element causes increasing array size by 2. This operation takes quite time because it copying all elements from smaller array to bigger. Howewer access to each node is very fast.
Available methods:
- Three types of constructor: non-parameter with default list size, with integer parameter to specify default size and copying constructor
- void add(E) - adding new elements to array. If array is filled creates new bigger array to store new values.
- int size() - returns number of elements in array.
- boolean isEmpty() - returns true if array has no elements.
- void clear() - deletes all elements in array and sets its size to default.
- E get(int) - returns element from array at index passed in parameter.
- E remove(int) - the same as get() but also remove element from array.
- boolean contains(E) - returns true if element passed in parameter is in structure
- int indexOf(E) - returns index of element in list or -1 if not exists
- void replace(E, int) - changes element at specified index
- void trimToSize() - changes size of list to fill all elements and avoid unnecesary memory alocation
- Object[] toArray() - returns array with elements copied from list
- Iterator[] iterator() - returns Iterator object that allows to move safely on ArrayList elements
- boolean hasNext() - returns true if array has next element after current element
- E next() - returns element reference after currently used
Available methods:
- void add(E) - create new node with element and put it at the end of list
- int size() - returns number of nodes.
- boolean isEmpty() - returns true if first node is null.
- void clear() - change first node to null.
- E get(int) - returns element from list at index passed in parameter.
- E remove(int) - the same as get() but also remove node from list.
- boolean contains(E) - returns true if element passed in parameter is in structure
- int indexOf(E) - returns index of element in list or -1 if not exists
- void replace(E, int) - changes element at specified index
- void toArray() - returns array with elements copied from list
- Iterator[] iterator() - returns Iterator object that allows to move safely on LinkedList elements
- boolean hasNext() - returns true if array has next element after current element
- E next() - returns element reference after currently used
Available methods:
Available methods:
Binary tree is a tree data structure in which each node has at most two children, which are referred to as the left child and the right child
Available methods:
- void insert(E)
- E getRoot()
- int countNodes()
- void printAscending()
- void printDescending()
- boolean contains(E)
- boolean isEmpty()
- E maximum()
- E minimun()
- void clear()
- hasNext() - returns true if array has next element after current element
- next() - returns element reference after currently used
Every method was tested using jUnit library