FRQ Type 1: Array Operations
Accessing Elements
- Use square brackets to access elements by their index.
- Array indices start from 0.
Modifying Elements
- Elements in an array can be changed by assigning a new value to a specific index.
- Use a for loop to iterate over an array and modify its elements.
FRQ Type 2: ArrayList Operations
Adding Elements
- Use the
add
method to insert elements at the end of an ArrayList.
- You can also insert elements at a specific index using the
add(index, element)
method.
Removing Elements
- The
remove
method allows you to delete an element by specifying its index.
- You can also remove elements by value using the
remove(Object o)
method.
FRQ Type 3: String Manipulation
Concatenation
- Strings can be combined using the
+
operator.
- The
concat
method can also be used for concatenation.
Substring
- Extract a portion of a string using the
substring
method.
- Specify the start and end indices to obtain the desired substring.
FRQ Type 4: Object-Oriented Programming
Classes and Objects
- Classes define the blueprint for objects, including attributes and methods.
- Objects are instances of classes, created with the
new
keyword.
Inheritance
- Inheritance allows a subclass to inherit properties and methods from a superclass.
- The
extends
keyword is used to establish inheritance.
FRQ Type 5: Searching and Sorting Algorithms
Linear Search
- Linear search iterates through an array to find a specific element.
- It has a time complexity of O(n) in the worst case.
Quick Sort
- Quick Sort is a sorting algorithm that uses a divide-and-conquer approach.
- It has an average time complexity of O(n log n).
FRQ Type 6: Recursion
Base Case
- Recursion must have a base case to terminate the recursive calls.
- The base case defines when the recursion stops.
Recursive Calls
- In a recursive function, it calls itself with different parameters.
- Each recursive call moves closer to the base case.