Pascal Programming Records, Stacks & Queues. Pascal Programming Record data types—a complex type that combines different data types into a single record.

Slides:



Advertisements
Similar presentations
Introduction to C Programming
Advertisements

Intro to Scala Lists. Scala Lists are always immutable. This means that a list in Scala, once created, will remain the same.
CHP-5 LinkedList.
Arrays, A1 COMP 401, Fall 2014 Lecture 4 8/28/2014.
Stacks - 3 Nour El-Kadri CSI Evaluating arithmetic expressions Stack-based algorithms are used for syntactical analysis (parsing). For example.
Records Dasar Pemrograman. RECORDS Record data types—a complex type that combines different data types into a single record. Sometimes called set types.
Chapter 10 Introduction to Arrays
DICTIONARIES. The Compound Sequence Data Types All of the compound data types we have studies in detail so far – strings – lists – Tuples They are sequence.
Faculty of Sciences and Social Sciences HOPE Structured Problem Solving Week 12: Data Structures 1 Stewart Blakeway FML 213
176 Formal Languages and Applications: We know that Pascal programming language is defined in terms of a CFG. All the other programming languages are context-free.
Topic 9 – Introduction To Arrays. CISC105 – Topic 9 Introduction to Data Structures Thus far, we have seen “simple” data types. These refers to a single.
Programming with Collections Collections in Java Using Arrays Week 9.
Arrays  Writing a program that uses a large amount of information.  Such as a list of 100 elements.  It is not practical to declare.
Stacks. 2 What is a stack? A stack is a Last In, First Out (LIFO) data structure Anything added to the stack goes on the “top” of the stack Anything removed.
Understanding Arrays and Pointers Object-Oriented Programming Using C++ Second Edition 3.
Fall 2007CS 2251 Lists and the Collection Interface Chapter 4.
Stacks. 2 What is a stack? A stack is a Last In, First Out (LIFO) data structure Anything added to the stack goes on the “top” of the stack Anything removed.
Chapter 8 Arrays and Strings
JavaScript, Third Edition
CORE 2: Information systems and Databases STORAGE & RETRIEVAL 2 : SEARCHING, SELECTING & SORTING.
The Stack and Queue Types Lecture 10 Hartmut Kaiser
Introduction to Data Structures. Data Structures A data structure is a scheme for organizing data in the memory of a computer. Some of the more commonly.
A Level Computing#BristolMet Session Objectives U2#S6 MUST identify different data types used in programming aka variable types SHOULD describe each data.
Simple Program Design Third Edition A Step-by-Step Approach
Fundamentals of Python: From First Programs Through Data Structures Chapter 14 Linear Collections: Stacks.
Comp 245 Data Structures Stacks. What is a Stack? A LIFO (last in, first out) structure Access (storage or retrieval) may only take place at the TOP NO.
Data Structures in Python By: Christopher Todd. Lists in Python A list is a group of comma-separated values between square brackets. A list is a group.
Computer Science Department Data Structure & Algorithms Problem Solving with Stack.
Fall 2001(c)opyright Brent M. Dingle 2001 Arrays Brent M. Dingle Texas A&M University Chapter 9 – Sections 1 and 2 (and some from Mastering Turbo Pascal.
Chapter 8 Arrays and Strings
EGR 2261 Unit 8 One-dimensional Arrays  Read Malik, pages in Chapter 8.  Homework #8 and Lab #8 due next week.  Quiz next week.
CMSC 202 Arrays. Aug 6, Introduction to Arrays An array is a data structure used to process a collection of data that is all of the same type –An.
COMP102 Lab 081 COMP 102 Programming Fundamentals I Presented by : Timture Choi.
What is an Array? An array is a collection of variables. Arrays have three important properties: –group of related items(for example, temperature for.
1 © 2002, Cisco Systems, Inc. All rights reserved. Arrays Chapter 7.
Review 1.Lexical Analysis 2.Syntax Analysis 3.Semantic Analysis 4.Code Generation 5.Code Optimization.
© Copyright 2012 by Pearson Education, Inc. All Rights Reserved. 1 Chapter 18 Linked Lists, Stacks, Queues, and Priority Queues.
Data TypestMyn1 Data Types The type of a variable is not set by the programmer; rather, it is decided at runtime by PHP depending on the context in which.
C++ Programming: Program Design Including Data Structures, Fourth Edition Chapter 18: Stacks and Queues.
C++ Programming: From Problem Analysis to Program Design, Fourth Edition Chapter 19: Stacks and Queues.
C++ Programming: Program Design Including Data Structures, Fourth Edition Chapter 18: Stacks and Queues.
5 1 Data Files CGI/Perl Programming By Diane Zak.
Slide 1 Linked Data Structures. Slide 2 Learning Objectives  Nodes and Linked Lists  Creating, searching  Linked List Applications  Stacks, queues.
Arrays and Collections Tonga Institute of Higher Education.
CS201: Data Structures and Discrete Mathematics I Hash Table.
AP Computer Science edition Review 1 ArrayListsWhile loopsString MethodsMethodsErrors
Pascal Programming Arrays and String Type.
Pointers *, &, array similarities, functions, sizeof.
Data Design and Implementation. Definitions Atomic or primitive type A data type whose elements are single, non-decomposable data items Composite type.
CHP-3 STACKS.
Copyright © Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Java From Control Structures through Data Structures by Tony.
Database to HTML and Back again A programmers tale.
Pascal Programming Complex Array Structures. Pascal Programming Complex solutions, using Pascal or any other language, need to be reduced from the abstract.
Arrays Declaring arrays Passing arrays to functions Searching arrays with linear search Sorting arrays with insertion sort Multidimensional arrays Programming.
Click to edit Master text styles Stacks Data Structure.
INTRODUCTION TO DATA STRUCTURES 1. DATA STRUCTURES A data structure is a scheme for organizing data in the memory of a computer. Some of the more commonly.
Pascal Programming Arrays and String Type.
Review Array Array Elements Accessing array elements
Ch. 8 File Structures Sequential files. Text files. Indexed files.
Programming the Web using XHTML and JavaScript
Data Types and Expressions
Introduction to C++ Programming
Chapter 5 SDL - Data 2007, rev. 08 SEG2101 Chapter 5.
Chapter 6 Control Statements: Part 2
Stacks.
LINEAR DATA STRUCTURES
Introduction to Computer Science
Presentation transcript:

Pascal Programming Records, Stacks & Queues

Pascal Programming Record data types—a complex type that combines different data types into a single record. Sometimes called set types. The individual elements of a record are called fields or components or component fields.

Pascal Programming Each field has a name...the field identifier. The field identifiers provide a means of accessing each field in the record, similar to an array index. Each field has a type, which is established when the record is declared. The value of a record is a collection of values. There is a value in each field.

Pascal Programming The component of a record variable is a component variable.. field identifier...specifies a component variable. –e g: Business1.PresidentsLastName Though a record is a collection of values, it can sometimes be treated as a single value.

Pascal Programming So... –The record variable describes the raw record. –Record value indicates all the values in the record. –Component values indicate the field values. –Field identifiers name the fields in record.

Pascal Programming Syntax... type –Business = record –BusinessName: string[30]; –StreetAddress: string[35] –City: string[20]; –State: string[2]; –zip: integer; end;

Pascal Programming A programmer may want to structure data with a hierarchy of records. e g: –student identification –birth date and age –core courses...etc...

Pascal Programming Records for a group may be read into an array. Thus, we see that... – data structures are a means of organizing, storing and manipulating data. How do we chose which structure to use? –Everything being equal, chose the one that can be understood and worked with most easily.

Pascal Programming If all items are of the same type...a single array of that type works best. If items differ in type, use an array of records. Or, use parallel arrays.

Pascal Programming with statements... With provides instruction(s) to carry out an operation. Syntax –with record_variable_list do statement (usually compound) The records_variable_list is separated by commas.

Pascal Programming Stacks and Queues The stack, a specialized data structure, compares to a stack of shoe boxes. New data goes into a box on the top of the stack. To read from the stack, access the first box, discard it, read the second box, discard it etc....

Pascal Programming Stacks serves the purpose of reversing the order of data -- first in, last out. e g: stacktop = (TopValue) This creates a decrementation of the stack. The text illustrated using the stack to match parenthesis. Find and save a left parenthesis then look for the right one, eliminate all characters in between. Cry fowl when a left parenthesis occurs again without a right one.

Pascal Programming Queue... A data structure for first in/first out data handling. The opposite of the stack. Like a waiting line...first come...first served. A queue can be implemented so that as the array empties and reaches the end the beginning fills again. It becomes circular.

Pascal Programming Pascal Sets Sets contain data like a list but that data is unordered. To use sets in a variable, we use set types The ordinals in the sets are its elements. These are the Base_type of the set.

Pascal Programming Example type –Grade = set of ; constant –superior: grade = [ ] The first illustrates the declaration of a set and the second the appending of a typed constant.