Arrays, Arraylists Flashcards
a set of well-
defined instructions to solve a
particular problem. It takes a
set of input(s) and produces the
desired output.
Algorithm
a storage that is
used to store and organize data.
Data Structure
the elements are arranged in sequence
one after the other. Since elements
are arranged in particular order,
they are easy to implement.
Linear Data Structure
are arranged in a
hierarchical manner where one
element will be connected to one or
more elements.
Non-Linear Data Structure
Fixed-size sequential collection of elements of the same kind.
Arrays
To find out how many elements an array has,
length
an array of arrays.
Multidimensional Arrays
Most basic type of Multidimensional Array and is also called the matrix
2d array
the Java Collection Framework. This class
provides static methods to
dynamically create and access
Java arrays.
Array Class
a part of the
Java collection framework and it
is a class of java.util package.
It provides us with dynamic
arrays in Java.
ArrayList
ArrayList in Java can be seen as a vector in
C++
Array List Advantages
- Dynamic size
- Easy to use
- Fast Access
- Ordered Collections
- Support Null Values
Array List Disadvantages
- Slower than arrays
- Increased Memory Usage
- Not Thread Safe
- Performance Degradation
ArrayLists Methods
add();
remove();
size();
get();
clear();
set();
Array Methods
toString();
binarySearch();
compare();
sort();