Deletion Operations

Introduction

Deletion looks simple — "just remove the item" — but in an array it is rarely that simple. Because array elements live in contiguous positions, removing one from anywhere other than the end leaves a hole that must be repaired by shifting every following element back one slot. That shifting is the hidden cost behind most deletion operations, and it is the reason deleting from the end is cheap while deleting from the beginning or middle is not.

In this topic you will work through the main deletion scenarios: removing from the end, from the beginning, from an arbitrary middle index, and removing by value rather than by position. You will also contrast mutating approaches (which change the original array in place, such as pop, shift, and splice) with non-mutating approaches like filter, which leaves the original untouched and returns a new array containing only the elements you wanted to keep. Knowing which style you are using matters a great deal once arrays are shared across functions.

As you watch, keep three questions in mind. First, what physically happens to the remaining elements and to the length after a removal? Second, how many element moves does each operation require in the worst case — constant work, or work proportional to n? Third, does the method you are using modify the original array or return a new one? The videos below approach these questions from two angles: a low-level C view that makes the shifting and memory behavior visible, and a practical JavaScript walkthrough of the built-in methods you will actually write in this course.

Video 1: Arrays: Deletion — Data Structures in C | 2.8

Glass Box Computing · 5:57 · 3 views · 2mo ago · captions — Watch on YouTube

About this video

A short, focused lesson on deleting an element from an array in C, stepping through what the removal actually does to the stored data. Based on its description, it emphasizes the gap left behind by a removal and the shifting needed to close it, along with the bookkeeping of tracking the array's logical size. Expect a step-by-step trace rather than a language-feature tour.

Why this video

It directly supports Understanding Deletion in Arrays and the beginning/middle cases by showing the shift operation explicitly, which is the mechanism JavaScript's built-in methods hide from you.

Video 2: Dynamic Arrays: Access, Insert & Delete — Data Structures in C | 3.7

Glass Box Computing · 5:14 · 6 views · 2mo ago · captions — Watch on YouTube

About this video

This lesson compares three dynamic-array operations side by side: access (get and set), insertion, and deletion. Per its description, it makes the key contrast explicit — indexed access stays O(1) while inserting or deleting in the middle still costs the O(n) shift, even when the array can grow and shrink on its own.

Why this video

It is the clearest fit for Time Complexity of Deletion Operations, giving you the cost comparison you need for Big O reasoning and for choosing an operation based on position.

Video 3: How to remove element using Javascript ? | The Complete JavaScript Course | Ep.60

Anurag Singh ProCodrr · 14:09 · 12,111 views · 3y ago · captions — Watch on YouTube

About this video

A JavaScript-focused episode from a full course series, walking through the practical ways to remove elements from an array in JavaScript. Given its title and course context, expect coverage of the built-in removal methods and worked code examples you can follow along with, at a pace that suits learners new to the language.

Why this video

It grounds the concepts in the JavaScript syntax this course uses, covering deleting from the end, beginning, middle, and by value in the environment where you will write your own implementations.

How These Videos Support the Learning Outcomes

Together these videos build toward MO1 by showing deletion both as a manual shifting algorithm and as a set of JavaScript built-in methods, so you can implement either approach. The dynamic-array comparison supports MO3 by naming the costs explicitly — O(1) access and end-removal versus O(n) shifting for beginning and middle deletions — and that same contrast feeds MO4, where you must choose an operation based on position and complexity trade-offs. The JavaScript walkthrough also prepares you for the non-mutating, higher-order style used in MO5, where filter removes elements by producing a new array rather than editing the original in place.

About These Videos

These videos were chosen from YouTube on October 2, 2026. Each has captions; the player turns them on. Videos on YouTube can be changed or removed — if one no longer plays, tell your instructor. If a player does not appear, use its Watch on YouTube link.