[go: up one dir, main page]

0% found this document useful (0 votes)
26 views7 pages

Array Programs C

The document presents five questions related to array operations, including finding the sum of elements, determining the minimum and maximum values, checking if the array is sorted, identifying the second largest element, and performing insertion and deletion. Each question includes a statement, example input and output, and general intuition for solving the problem. Additionally, it provides links to further problems related to arrays.

Uploaded by

varunlagala22
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views7 pages

Array Programs C

The document presents five questions related to array operations, including finding the sum of elements, determining the minimum and maximum values, checking if the array is sorted, identifying the second largest element, and performing insertion and deletion. Each question includes a statement, example input and output, and general intuition for solving the problem. Additionally, it provides links to further problems related to arrays.

Uploaded by

varunlagala22
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 7

ARRAY – QUESTIONS

5 questions -CS HUB


SUM OF ELEMENTS IN ARRAY

• **Question Statement:**
• Given an array of integers,
find the sum of all its
elements.

• **Example:**
• Input: arr = [1, 2, 3, 4]
• Output: 10

• **General Intuition:**
• Iterate through the array
and accumulate the sum of
elements.
FIND MIN AND MAX IN ARRAY

• **Question Statement:**
• Find the minimum and
maximum elements in the
given array.

• **Example:**
• Input: arr = [3, 1, 4, 1, 5]
• Output: Min = 1, Max = 5

• **General Intuition:**
• Iterate and keep track of the
smallest and largest values.
CHECK IF ARRAY IS SORTED

• **Question Statement:**
• Check if the given array is
sorted in non-decreasing
order.

• **Example:**
• Input: arr = [1, 2, 3, 4]
• Output: Yes

• **General Intuition:**
• Compare each element
with the next; if any
element is greater, it is not
sorted.
SECOND L ARGEST ELEMENT IN
ARRAY

• **Question Statement:**
• Find the second largest
element in the array.

• **Example:**
• Input: arr = [10, 20, 4, 45,
99]
• Output: 45

• **General Intuition:**
• Track the largest and second
largest values in one pass.
INSERTION AND DELETION IN
ARRAY

• **Question Statement:**
• Perform insertion and deletion
operations in an array.

• **Example:**
• Input: arr = [1, 2, 3], insert 4 at
position 2
• Output after insertion: [1, 4, 2,
3]

• **General Intuition:**
• Shift elements to the right for
insertion, and to the left for
deletion.
SOLVE

1. https://www.geeksforgeeks.org/problems/remove-duplicate
-elements-from-sorted-array/1
2. https://www.geeksforgeeks.org/problems/cyclically-rotate-a
n-array-by-one2614/1
3. https://www.geeksforgeeks.org/problems/missing-number-i
n-array1416/1

You might also like