14_data_struct

14_data_struct - Introduction to Computers and Programming...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Introduction to Computers and Programming Lecture 14 Data Structures algorithms tables, Trees, Graphs, … Prof. I. K. Lundqvist Reading: B pp. 302-318, FK pp. 385-413, 469-474 Oct 6 2003 • Program design = data structures + – Arrays, Stacks, Queues, Linked lists, Hash – Binary search, insertion sort, … • Static vs. dynamic data structures • Linear data structures – The elements form a sequence or linear list Linear lists • Ordered collection of data – data is arranged into some order (not necessarily sorted) – data is referenced by its position within the list Operation Explanation Initialize Initialize the internal structure of the list, make sure it’s empty Empty Returns true iff the list is empty Insert Inserts a new element after the k th element; if k is zero, then insert at the beginning of the list Delete Delete the k th item in the list Arrays • Data structure which groups related items together a day 68 42 75 73 56 93 72 84 Marks Marks (1) Marks (8) about several different things • the mark on a test for each student in a class – related in that they record similar data • the temperature on the hour, at each hour during • etc Array index vs. array element • – labels are going to be • index type range of values can the index take? • ENUMERATED TYPE type of information can go into each box. • element type • any type – the array items Example [1/3] When designing an array, you need to decide what the • of value is the index? the array index may be INTEGER, CHARACTER or any the array element type can be Courtesy of Chris Lokan. Used with permission. the array what • what – what the array the type of the array index is not related to the type of Example [2/3] • – element type is INTEGER – – • – element type is FLOAT – – • – element type is STRING – – Declaring Arrays form of the array enumeration type, or any derived type or subtype of these) is not related to index type type...
View Full Document

{[ snackBarMessage ]}

Page1 / 12

14_data_struct - Introduction to Computers and Programming...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online