diff --git a/src/data_structures/intro.md b/src/data_structures/intro.md new file mode 100644 index 0000000..ad8ee04 --- /dev/null +++ b/src/data_structures/intro.md @@ -0,0 +1,15 @@ +# Java Data Structures + +Java offers a wide array of data structures which are part of the Java Collections Framework. These data structures allow you to organize and store data in different ways, depending on your needs. + +1. **Array**: This is the simplest data structure where data is stored in a linear, or one-dimensional, structure. Arrays are of fixed size and allow random access to elements. +2. **ArrayList**: Similar to an array but it is dynamic in size. It allows elements to be inserted or removed. +3. **LinkedList**: It is a linear data structure where elements are not stored in contiguous locations but are linked using pointers. It allows faster insertion and removal compared to an ArrayList. +4. **Stack**: This is a linear data structure that follows the LIFO (Last In First Out) principle. Operations like push (insertion), pop (removal) and peek (get the top element) are typically performed on a stack. +5. **Queue**: Another linear data structure that follows the FIFO (First In First Out) principle. Elements are added at the end and removed from the beginning. +6. **HashSet**: This is a collection that doesn't allow duplicate elements. It has no order of elements and doesn't allow null values. +7. **TreeSet**: This is a sorted collection that doesn't allow duplicate elements. It maintains ascending order. +8. **HashMap**: This is a structure that uses a hash function to map keys to values. It allows null keys and values. +9. **TreeMap**: This is a map implementation in the form of a tree structure. It maintains ascending order. + +Understanding the characteristics of each data structure can help you choose the right one for your specific programming needs.