- Definition: An ordered collection of elements, each identified by an index.
- Types:
- One-dimensional arrays
- Multi-dimensional arrays (matrices)
- Indexing: Accessing elements using their index.
- Slicing: Extracting subsets of an array.
- Creating arrays:
- Using the
list
constructor - Using list comprehension
- Using the numpy.array Function (for NumPy arrays)
- Using the
- Accessing elements:
- Using index
- Modifying elements:
- Assigning new values
- Adding/removing elements:
append
,insert
,pop
,remove
- Iterating over arrays:
- Using
for
loops
- Using
- Sorting arrays:
- Built-in
sort
method - Using
sorted
function
- Built-in
- Searching for elements:
- Linear search
- Binary search (for sorted arrays)
- Array manipulation:
- Reversing
- Concatenating
- Copying
- Multi-dimensional arrays:
- Creating and accessing
- Matrix operations (addition, subtraction, multiplication)
- NumPy library:
- Introduction and basic operations
- Advanced features (broadcasting, slicing, indexing)
- Create an array of integers and print the first and last elements.
- Given an array, find the sum of all its elements.
- Reverse an array in-place.
- Find the maximum and minimum elements in an array.
- Check if an array contains a given element.
- Implement linear search.
- Implement bubble sort.
- Find the second largest element in an array.
- Rotate an array by k positions.
- Given two arrays, find their intersection.
- Implement binary search.
- Merge two sorted arrays.
- Find the median of two sorted arrays of equal size.
- Find the longest common subsequence between two strings.
- Implement matrix multiplication.