Total Pageviews

Monday, August 31, 2026

🗑️ ARRAY DELETION AT FRONT

🗑️ ARRAY DELETION AT FRONT
Delete the first element and shift every remaining element one position to the LEFT

📥 Enter Array Values

🎬 Step-by-Step Animation

Enter values and press START DELETE.

📊 Operation Statistics

Array Size 0
Shifts Completed 0

📝 Step-by-Step Explanation

🧮 Mathematical Representation

Original Array
A = [10, 20, 30, 40, 50]

First element is deleted:
DELETE A[0]

Deleted value:
10

Now shift the remaining elements LEFT:

A[0] ← A[1]

20 moves from index 1 to index 0.

A[1] ← A[2]

30 moves from index 2 to index 1.

A[2] ← A[3]

40 moves from index 3 to index 2.

A[3] ← A[4]

50 moves from index 4 to index 3.

Finally:
n = n − 1

Therefore:
[20, 30, 40, 50]

💻 Algorithm

DELETE_FRONT(A,n)

Step 1: Delete the first element.

Step 2: Start from the second element.

Step 3: Move each element one position LEFT.

For: i = 1 to n − 1

Perform: A[i − 1] = A[i]

Step 4: n = n − 1

⏱️ Time and Space Complexity

Time Complexity O(n)
Number of Shifts n − 1

🎯 Final Result

Result will appear here.

No comments:

Post a Comment