☑️Data Structures
📚 Array 📚
public class ArrayExample {
public static void main(String[] args) {
// Declare and initialize an array of integers
int[] numbers = {5, 10, 15, 20, 25};
// Access elements in the array using their index
int firstNumber = numbers[0]; // Access the first element (index 0)
int thirdNumber = numbers[2]; // Access the third element (index 2)
// Modify elements in the array
numbers[1] = 12; // Change the second element (index 1) to 12
// Get the length of the array
int length = numbers.length; // Returns 5
// Iterate over the elements in the array
for (int i = 0; i < numbers.length; i++) {
System.out.println(numbers[i]);
}
}
}📒 Linked List 📒
Key Characteristics
🗃️ Stack 🗃️
📦 Queue 📦
🌳 Binary Tree 🌳
🗄️ Hash Table 🗄️
📊 Heap 📊
📎 Graph 📎
Last updated