![]() |
VOOZH | about |
Given an array arr[] consisting of N integers, the task is to find the largest element in the given array using Dynamic Memory Allocation.
Examples:
Input: arr[] = {4, 5, 6, 7}
Output: 7
Explanation:
The largest element present in the given array is 7.Input: arr[] = {8, 9, 10, 12}
Output: 12
Explanation:
The largest element present in the given array is 12.
The idea here is to use Dynamic Memory for searching the largest element in the given array. Follow the steps below to solve the problem:
20
Time Complexity: O(N)
Auxiliary Space: O(1)