ABSTRACT

An Array implementation of a Lexicon relies on Random Access to enable Binary Search. While it incurs a high cost for modifications ( to shift elements), it is a superior choice for a Lexicon where word lookups are frequent and the dictionary remains relatively static.


1. Why Sorting Matters

In a Lexicon, an unsorted array is no better than a Linked List Implementation (requiring a Linear Search). However, a Sorted Array changes the math:

  • Random Access: Because array slots are contiguous in memory, we can calculate the address of any index in time.
  • Binary Search: Using random access, we can check the middle element, discard half the list, and repeat. This reduces the search space from to in just steps.

2. Performance Analysis

Because we keep the array sorted and compact (no gaps), our complexity reflects the cost of maintaining that order.

OperationComplexityLogic
find(word)Enabled by Binary Search.
insert(word)Must shift existing elements to maintain alphabetical order.
remove(word)Must shift elements to fill the gap left by the deleted word.
Space slots for words, plus potential overhead for dynamic resizing.

3. Evaluation for Lexicon ADT

The Array implementation aligns well with our specific Lexicon assumptions:

  • Fast Lookups: is a massive improvement over . For a dictionary of 170,000 words, Binary Search takes about 18 comparisons, whereas a Linked List could take 170,000.
  • Infrequent Updates: While insertion is slow, it is acceptable in this context because we rarely add or remove words from a language.
  • Memory Efficiency: Arrays are very space-efficient, though Dynamic Arrays may temporarily double their allocated space () to accommodate growth.

4. Comparison: Linked List vs. Array

FeatureLinked ListSorted Array
Search Speed
Random AccessNoYes
Insertion (if unsorted)
Memory OverheadPointers for every nodeContiguous block