SlideServe
Menu
Préférences
© SlideServe · v2026

ADT Lists: Array and Pointer Implementations in CS 303

austin avatar
6 diapositives · 209 Views · Oct 11, 2013

Abstract data types (ADT) and their implementations focusing on lists using arrays and pointers. Key operations such as MakeNull, Insert, Delete, and element retrieval are explored. The discussion contrasts the intricacies of single pointer implementations with the efficiency of arrays and cursors. Situations where pointers are not natively supported are addressed by suggesting the use of cursor management for dynamic memory. Various implementations, including doubly linked lists and rings, are examined to understand their practical applications and behaviors within data structures.

ADT Lists: Array and Pointer Implementations in CS 303 - slide 1
01 / 6ADT Lists: Array and Pointer Implementations in CS 303
1 / 17

Télécharger la présentation

ADT Lists: Array and Pointer Implementations in CS 303
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Lists ADT Array Implementation Single Pointer Implemention Cursors Doubly Linked Ring CS 303 –Lists Lecture 4

  2. ADT List - Operations • L = MakeNull() • Insert(L,p,x) Delete(L,p) • p = First(L) p = End(L) • p = Previous(L,p) p = Next(L,p) • p = Locate(L,x) • x = Retrieve(L,p) • x: ElementType • p: PositionType • L: ListType • Why isn’t First(L)always 1? • Because Position is hidden! No arithmetic is allowed (by the user) on • Positions. Use Previous and Next! CS 303 –Lists Lecture 4

  3. Array Implementation 1 2 n MaxLength Last Internal routines can do arithmetic on “positions”, but external (user) routines cannot. Why? CS 303 –Lists Lecture 4

  4. Single Pointer Implementation • L ... Header What is the purpose of the header? (Hing: consider “position”) Compare details (efficiency, behavior of “position”) with Array Implementation Array Pointer Previous/End EASY HARD Insert/Delete HARD EASY CS 303 –Lists Lecture 4

  5. Cursors (an aside) • Suppose you want to use pointers – but your programming • environment does not support them? • Use “cursors” • Allocate an Array called CursorSpace • Use indices into CursorSpace just like pointers • Do your own memory management of cells • New • Dispose CS 303 –Lists Lecture 4

  6. Doubly Linked Lists/Rings L • Many variations • Is ‘?’ a0 (Header) or a1? [a1] • Is ‘L’ part of the structure, or an external pointer? [external] • Is there a “First” element? [where L points!] • Implement the full Ring! • Everything is EASY; Position is natural CS 303 –Lists Lecture 4