Problem statement
Given an operation workload, compare estimated work for a fixed unsorted array, a sorted array, and a dynamic array.
The fixed array is full. Each operation is priced at the sample's baseline length using worst-case work, and the lowest supported total is recommended.
Examples
Inputn = 8; four searches and one indexed read
Outputfixed 33, sorted 17, dynamic 33; choose sorted
Sorted order reduces each worst-case search to four comparisons.
Inputn = 8; insert at 4, delete at 4, insert at 3
Output12 shifts for each layout; tie
The layouts shift 4 + 3 + 5 cells for these edits.
The walkthrough is part of Premium
The statement and the examples above stay free. The full how-to-solve walkthrough, the cost notes in plain words and the interactive step-by-step visualizer unlock with a Premium plan.
See pricing