Lecture 1 Data Structures Shafay Shamail September 05, 2006.

Slides:



Advertisements
Similar presentations
Linear Lists – Array Representation
Advertisements

Lists: An internal look
Liang, Introduction to Java Programming, Ninth Edition, (c) 2013 Pearson Education, Inc. All rights reserved. 1 Chapter 9 Strings.
Longest Common Subsequence
Chapter 6 Structures By C. Shing ITEC Dept Radford University.
Introduction to Programming Lecture 39. Copy Constructor.
Introduction to Data Structures CMPE231 Spring 2012 Assoc. Prof. Alexander Chefranov 1.
Chapter 7 Strings F To process strings using the String class, the StringBuffer class, and the StringTokenizer class. F To use the String class to process.
Lecture 09 Strings, IDEs. METU Dept. of Computer Eng. Summer 2002 Ceng230 - Section 01 Introduction To C Programming by Ahmet Sacan Mon July 29, 2002.
Chapter 3 DATA: TYPES, CLASSES, AND OBJECTS. Chapter 3 Data Abstraction Abstract data types allow you to work with data without concern for how the data.
Chapter 7 Strings F Processing strings using the String class, the StringBuffer class, and the StringTokenizer class. F Use the String class to process.
M180: Data Structures & Algorithms in Java
Lecture # 02 07/02/2013Dr. Muhammad Umair 1. 07/02/2013Dr. Muhammad Umair 2  Numeric  Integer Numbers  0,10,15,4563 etc.  Fractional Number  10.5,
©2004 Brooks/Cole Chapter 8 Arrays. Figures ©2004 Brooks/Cole CS 119: Intro to JavaFall 2005 Sometimes we have lists of data values that all need to be.
1 Data Structures CSC Data Types & Data Structures Applications/programs read, store and operate on data. Finally output results. What is data?
1 Data Structures: Introduction CSC Data Types & Data Structures Applications/programs read data, store data temporarily, process it and finally.
Abstract Data Types (ADT)
Rossella Lau Lecture 1, DCO20105, Semester A, DCO Data structures and algorithms  Lecture 1: Introduction What this course is about:  Data.
Rossella Lau Lecture 1, DCO20105, Semester A, DCO Data structures and algorithms  Lecture 1: Introduction What this course is about:  Data.
Lists CSE1303 Part A Data Structures and Algorithms.
Kymberly Fergusson CSE1303 Part A Data Structures and Algorithms Summer Semester 2003 Lecture A5 – Basic Data Structures – Continued (Lists)
Data Type. A data type defines a set of values that a variable can store along with a set of operations that can be performed on that variable. Common.
Chapter 3 Data Structures and Abstract Data Type Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2008.
Data Structures 1- Course Syllabus. 2- Introduction about Data Structures.
Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Cpt S 122 – Data Structures Custom Templatized Data Structures.
Introduction to Data Structures. Definition Data structure is representation of the logical relationship existing between individual elements of data.
1 Chapter 3 Lists, Stacks, and Queues Abstract Data Types, Vectors Sections 3.1, 3.2, 3.3, 3.4 Abstract Data Types (ADT) Iterators Implementation of Vector.
Basic Data Structures – Continued (Lists). 2 Basic Data Types Stack Last-In, First-Out (LIFO) initialize, push, pop, status Queue First-In, First-Out.
Containers Overview and Class Vector
C Tokens Identifiers Keywords Constants Operators Special symbols.
Lecture DS & Algorithms:09 Abstract Data Types. Lecture DS & Algorithms:09 2 Abstract Data Types Data Type: A data type is a collection of values and.
Computer Science Department Data Structures and Algorithms Lecture 1.
Introduction to STL and the vector container class CS342 Data Structures Based on Ford & Topp.
Main Index Contents 11 Main Index Contents Week 3 – The Vector Container.
Chapter 5 – Dynamic Data Structure Par1: Abstract Data Type DATA STRUCTURES & ALGORITHMS Teacher: Nguyen Do Thai Nguyen
Prepared By Ms.R.K.Dharme Head Computer Department.
GUIDED BY- A.S.MODI MADE BY- 1. SHWETA ALWANI 2. PRIYANKA.
Cosc237/data structures1 Data Types Every data type has two characteristics: 1.Domain - set of all possible values 2.set of allowable operations Built-in.
(1 - 1) Introduction to C Data Structures & Abstract Data Types Instructor - Andrew S. O’Fallon CptS 122 (August 26, 2015) Washington State University.
Data structures Abstract data types Java classes for Data structures and ADTs.
Built-in Data Structures in Python An Introduction.
Data Structures and Algorithms Lecture 1 Instructor: Quratulain Date: 1 st Sep, 2009.
Data Structures Lecture 1: Introduction. Course Contents Data Types   Overview, Introductory concepts   Data Types, meaning and implementation  
1 Linked-list, stack and queue. 2 Outline Abstract Data Type (ADT)‏ Linked list Stack Queue.
Data Structure and c K.S.Prabhu Lecturer All Deaf Educational Technology.
Elementary Data Organization. Outline  Data, Entity and Information  Primitive data types  Non primitive data Types  Data structure  Definition 
APS105 Lists. Structures Arrays allow a collection of elements –All of the same type How to collect elements of different types? –Structures; in C: struct.
Slides created by: Professor Ian G. Harris Hello World #include main() { printf(“Hello, world.\n”); }  #include is a compiler directive to include (concatenate)
Generic lists Vassilis Athitsos. Problems With Textbook Interface? Suppose that we fix the first problem, and we can have multiple stacks. Can we have.
Week 2 - Friday.  What did we talk about last time?  Computing Big Oh.
Dale Roberts Department of Computer and Information Science, School of Science, IUPUI CSCI 240 Elementary Data Structures Array Lists Array Lists Dale.
1 Unit-2 Arrays, Strings and Collections. 2 Arrays - Introduction An array is a group of contiguous or related data items that share a common name. Used.
REEM ALMOTIRI Information Technology Department Majmaah University.
 Data Type is a basic classification which identifies different types of data.  Data Types helps in: › Determining the possible values of a variable.
Prof. Amr Goneid, AUC1 CSCE 210 Data Structures and Algorithms Prof. Amr Goneid AUC Part R2. Elementary Data Structures.
Lecture 1 Data Structures Aamir Zia. Introduction Course outline Rules and regulations Course contents Good Programming Practices Data Types and Data.
Introduction toData structures and Algorithms
CSCI-255 LinkedList.
ENERGY 211 / CME 211 Lecture 19 November 3, 2008.
CSCE 210 Data Structures and Algorithms
– Introduction to Object Technology
DATA HANDLING.
نوع داده هاي انتزاعي Abstract Data Types
Data structures and algorithms
Data Structures and Programming Techniques
Data Structures: Introduction
Introduction to Data Structure
By Yogesh Neopaney Assistant Professor Department of Computer Science
(1 - 2) Introduction to C Data Structures & Abstract Data Types
Data Structures: Introduction
Presentation transcript:

Lecture 1 Data Structures Shafay Shamail September 05, 2006

Introduction Course outline Rules and regulations Course contents Grading

Rules Conventions Good Programming Practices

Data Types Simple (basic) –char, int, float, double Modifiers –signed, unsigned Qualifiers –static, const, volatile, void Structured (derived) –Arrays, structures, unions, classes Advanced (composite) –List, queues, stacks, trees, graphs

Abstract Data Type (ADT) Abstraction –Separating data from implementation –Generalization ADT –A collection of related data items together with basic operations between them and operations to be performed on them

Arrays Definition –Collection of items of same type in contiguous memory ADT –Collection of data items/elements A fixed size sequence (ordered set) of elements, all of the same type –Basic operations Direct access to each element in the array so that values can be retrived from or stored in this element

Structures Definition –Collection of items of same or different types in contiguous memory ADT –Collection of data elements A fixed-size sequence (ordered set) of elements, not necessarily of the same type. The elements are called members or fields. –Basic operations Direct access to each member of the structure so that values can be retrieved or stored in this member

Strings Definition –Collection of characters in contiguous memory –A special form of array ADT –Collection of data elements A finite sequence of characters drawn from some given character set –Basic operations Input, output, compare, copy, insert, replace, length, concatenate, find, delete

Sequences S = S is of length n len(S) = n first(S) s 0 last(S) = S n-1 len(nilseq) = 0 first(nilseq) not defined last(nilseq) = not defined

Sequences … abstract typedef > stp1; –An ADT of a sequence spt1 of arbitrary length consisting of elements of same type tp abstract typedef stp2; –ADT stp2, whose values are sequences of fixed length, and of elements of specific type abstract typedef > stp3; –ADT stp3, a sequence of fixed length n, all of same type tp elements

Sequences … abstract typedef > seq1; –Sequence of integers of any length abstract typedef seq2; –Sequence of length 3, consisting of int, char, float abstract typedef > seq3; –Sequence of 10 integers abstract typedef > seq4; –Arbitrary sequence of length 2 (pair)

Sequences … Two sequences are equal if each element of the first is equal to the corresponding element of the second A subsequence is a contiguous portion of a sequence –If S is a sequence then sub(S, i, j) consists of j elements starting at location i within S Concatenation U = S+T –All elements of S followed by all elements of T Place (S, i, x) –Insert x after position i, or at first position if i=-1, and shift all remaining elements to right by one position –place (S, i, x) = sub(S, 0, i-1) + + sub(S, i+1, len(S)-(i+1)) Delete –S- = Sequence S without all occurrences of S –delete(S, i) = delete element at position I = sub(S, 0, i) + sub(S, i+1, len(S)-(i+1))

ADT RATIONAL /* value definition */ abstract typedef RATIONAL; condition RATIONAL[1] != 0; /* operator definition */ abstract RATIONAL makerational(a,b) Int a,b; preconditionb != 0; postconditionmakerational[0] == a; makerational[1] == b; abstract RATIONAL add(a, b) RATIONAL a, b; postconditionadd[1] == a[1]*b[1]; add[0] == a[0]*b[1] + b[0]*a[1]; abstract RATIONAL mult(a, b) RATIONAL a, b; postconditionmult[0] == a[0]*b[0]; mult[1] == a[1]*b[1]; abstract RATIONAL equal(a, b) RATIONAL a, b; postconditionequal == (a[0]*b[1] == b[0]*a[1]);

ADT STRING /* value definition */ abstract typedef > STRING; /* operator definition */ abstract length (s) STRING s; postconditionlength == len(s); abstract STRING concat(s1, s2) STRING s1, s2; postconditionconcat == s1+s2; abstract STRING substr(s, i, j) STRING s; int i, j; precondition0 <= i < len(s); 0 <= j <= len(s) - i; postconditionsubstr == sub(s, i, j); abstract pos(s1, s2) STRING s1, s2; postcondition/* lastpos = len(s1) – len(s2) */ ((pos==-1) && (for (i=0; i<=lastpos; i++) (s2<>sub(s1, I, len(s2)))));

ADT ARRAY /* value definition */ abstract typedef > ARRTYPE(ub, eltype); /* operator definition */ abstract eltype extract(a, i) ARRTYPE(ub, eltype) a; int i; precondition0 <= i < ub; postconditionextract == a i ; abstract store(a, i, elt) ARRTYPE(ub, eltype) a; int i; eltype elt; precondition0 <= i < ub; postconditiona[i] == elt i ;