DATA STRUCTURES CHAPTER 1

Similar documents
Data Structures and Algorithms in Java. Second Year Software Engineering

STUDY NOTES UNIT 1 - INTRODUCTION TO OBJECT ORIENTED PROGRAMMING

CS201 - Introduction to Programming Glossary By

Short Notes of CS201

CHARUTAR VIDYA MANDAL S SEMCOM Vallabh Vidyanagar

Chapter 4 Defining Classes I

EXPRESSIONS AND ASSIGNMENT CITS1001

Fundamentals of Programming Languages

CSE115 / CSE503 Introduction to Computer Science I. Dr. Carl Alphonce 343 Davis Hall Office hours:

Introduction to Programming Using Java (98-388)

Lecture Overview. [Scott, chapter 7] [Sebesta, chapter 6]

Nested Loops. A loop can be nested inside another loop.

The Lorax Programming Language

NOTE: Answer ANY FOUR of the following 6 sections:

BCS THE CHARTERED INSTITUTE FOR IT. BCS HIGHER EDUCATION QUALIFICATIONS BCS Level 5 Diploma in IT OBJECT ORIENTED PROGRAMMING

Data Structures. Data structures. Data structures. What is a data structure? Simple answer: a collection of data equipped with some operations.

Lesson 02 Data Types and Statements. MIT 11053, Fundamentals of Programming By: S. Sabraz Nawaz Senior Lecturer in MIT Department of MIT FMC, SEUSL

Arrays. Defining arrays, declaration and initialization of arrays. Designed by Parul Khurana, LIECA.

Arrays and Lists CSC 121 Fall 2015 Howard Rosenthal

Datatypes, Variables, and Operations

Data Structures and Algorithms. Chapter 1

CS558 Programming Languages

Object Oriented Methods : Deeper Look Lecture Three

Exam 1 Prep. Dr. Demetrios Glinos University of Central Florida. COP3330 Object Oriented Programming

CPS 506 Comparative Programming Languages. Programming Language

VARIABLES AND TYPES CITS1001

Contents. I. Classes, Superclasses, and Subclasses. Topic 04 - Inheritance

Why Study Assembly Language?

Arrays and Lists CSC 121 Fall 2016 Howard Rosenthal

Java Fundamentals (II)

9 Working with the Java Class Library

Zhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson

ADVANCED DATA STRUCTURES STUDY NOTES. The left subtree of each node contains values that are smaller than the value in the given node.

COS 140: Foundations of Computer Science

Lecture 18 Tao Wang 1

Chapter 5: Procedural abstraction. Function procedures. Function procedures. Proper procedures and function procedures

9/5/17. The Design and Implementation of Programming Languages. Compilation. Interpretation. Compilation vs. Interpretation. Hybrid Implementation

CS558 Programming Languages

CPS122 Lecture: From Python to Java last revised January 4, Objectives:

What are the characteristics of Object Oriented programming language?

Lecture 6 Introduction to Objects and Classes

Data Structures. BSc in Computer Science University of New York, Tirana. Assoc. Prof. Marenglen Biba 1-1

Arrays and Lists CSC 121 Fall 2014 Howard Rosenthal

CE221 Programming in C++ Part 2 References and Pointers, Arrays and Strings

OO is considered to be supported in three points which are usually symbolized as the three vertexes of a triangle: Encapsulació i ocultació

Fundamentals of Programming. Lecture 12: C Structures, Unions, Bit Manipulations and Enumerations

Arrays and Lists Review CSC 123 Fall 2018 Howard Rosenthal

Objectives of CS 230. Java portability. Why ADTs? 8/18/14

CE221 Programming in C++ Part 1 Introduction

Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub

Jump Statements. The keyword break and continue are often used in repetition structures to provide additional controls.

Module Contact: Dr Geoff McKeown, CMP Copyright of the University of East Anglia Version 1

Weiss Chapter 1 terminology (parenthesized numbers are page numbers)

CS2102, B11 Exam 1. Name:

JAVA GUI PROGRAMMING REVISION TOUR III

Chapter 2: Using Data

Chapter 2 Working with Data Types and Operators

Declarations and Access Control SCJP tips

Data Structure. Recitation III

Chapter 1 GETTING STARTED. SYS-ED/ Computer Education Techniques, Inc.

ECE 122. Engineering Problem Solving with Java

Unit 3. Operators. School of Science and Technology INTRODUCTION

Object-Oriented Design (OOD) and C++

Grade Weights. Language Design and Overview of COOL. CS143 Lecture 2. Programming Language Economics 101. Lecture Outline

Lesson 02 Data Types and Statements. MIT 12043, Fundamentals of Programming By: S. Sabraz Nawaz Senior Lecturer in MIT Department of MIT FMC, SEUSL

9/7/17. Outline. Name, Scope and Binding. Names. Introduction. Names (continued) Names (continued) In Text: Chapter 5

COS 140: Foundations of Computer Science

Chapter 13 Object Oriented Programming. Copyright 2006 The McGraw-Hill Companies, Inc.

BCS THE CHARTERED INSTITUTE FOR IT. BCS HIGHER EDUCATION QUALIFICATIONS BCS Level 5 Diploma in IT. Object Oriented Programming

Introduction Primitive Data Types Character String Types User-Defined Ordinal Types Array Types. Record Types. Pointer and Reference Types

On Academic Dishonesty. Declarative Computation Model. Single assignment store. Single assignment store (2) Single assignment store (3)

Java How to Program, 10/e. Copyright by Pearson Education, Inc. All Rights Reserved.

Visual C# Instructor s Manual Table of Contents

CSCI 2010 Principles of Computer Science. Data and Expressions 08/09/2013 CSCI

Abstract Data Types. CS 234, Fall Types, Data Types Abstraction Abstract Data Types Preconditions, Postconditions ADT Examples

Computational Expression

Collection Considerations

CS 6456 OBJCET ORIENTED PROGRAMMING IV SEMESTER/EEE

Fall 2017 CISC124 9/16/2017

Data and Expressions. Outline. Data and Expressions 12/18/2010. Let's explore some other fundamental programming concepts. Chapter 2 focuses on:

Programming Paradigms

COE318 Lecture Notes Week 3 (Week of Sept 17, 2012)

Using R to provide statistical functionality for QSAR modeling in CDK

Basic Types & User Defined Types

Concepts Introduced in Chapter 7

10. Abstract Data Types

2. The object-oriented paradigm!

COMP 250 Fall inheritance Nov. 17, 2017

CSc 225 Algorithms and Data Structures I Algorithm Analysis

C++ Programming Fundamentals

Software and Programming 1

2. The object-oriented paradigm

COMP 250: Java Programming I. Carlos G. Oliver, Jérôme Waldispühl January 17-18, 2018 Slides adapted from M. Blanchette

Java Identifiers, Data Types & Variables

Chapter 1 INTRODUCTION SYS-ED/ COMPUTER EDUCATION TECHNIQUES, INC.

Data Types. Data Types. Introduction. Data Types. Data Types. Data Types. Introduction

CS2210 Data Structures and Algorithms

CSC Java Programming, Fall Java Data Types and Control Constructs

Object interactions Lecture 6

Object Oriented Design: Identifying Objects

Transcription:

DATA STRUCTURES CHAPTER 1 FOUNDATIONAL OF DATA STRUCTURES This unit introduces some basic concepts that the student needs to be familiar with before attempting to develop any software. It describes data type and data structures, explaining the operations that may be performed on them. The unit introduces you to the fundamental notions of data structures, thus guiding you through and facilitating your understanding of the subsequent units. OBJECTIVES By the end of this unit, you should be able to: describe and use the following notions; data type, abstract data type and data structure outline the classification of data type give typical examples of data type explain the relevance of data structures in programming. 0 Data Type In computer programming, a data type simply refers to a defined kind of data, that is, a set of possible values and basic operations on those values. When applied in programming languages, a data type defines a set of values and the allowable operations on those values. Data types are important in computer programmes because they classify data so that a translator (compiler or interpreter) can reserve appropriate memory storage to hold all possible values, e.g. integers, real numbers, characters, strings, and Boolean values, all have very different representations in memory. A data type consists of: 0 a domain (= a set of values) www.naarocom.com Page 1

1 a set of operations that may be applied to the values. 23 Data Type Classification Some data items may be used singly whilst others may be combined together and arranged to form other data items. The former are classified as simple data types whereas the latter are classified as data structures. However, the following classification is appropriate for study at this level.the simple data types are classified as follows: 0 Character 1 Numeric integer 2 Numeric real 3 Boolean (logical). 3.2.1 Examples of Data Types Almost all programming languages explicitly include the notion of data type, though different languages may use different terminology. Common data types in programming languages include those that represent integers, floating point numbers, and characters, and a language may support many more. Example 1: Boolean or logical data type provided by most programming languages. 0 Two values: true, false. 1 Many operations, including: AND, OR, NOT, etc. Example 2: In Java programming language, the int type represents the set of 32-bit integers ranging in value from -2,147, 483, 648 to 2,147, 483, 647 and the operation such as addition, subtraction and multiplication that can be performed on integers. 23 Abstract Data Type An Abstract Data Type commonly referred to as ADT, is a collection of data objects characterized by how the objects are accessed; it is an abstract human concept www.naarocom.com Page 2

meaningful outside of computer science. (Note that "object", here, is a general abstract concept as well, i.e. it can be an "element" (like an integer), a data structure (e.g. a list of lists), or an instance of a class. (e.g. a list of circles). A data type is abstract in the sense that it is independent of various concrete implementations. Object-oriented languages such as C++ and Java provide explicit support for expressing abstract data types by means of classes. A first class abstract data type supports the creation of multiple instances of ADT and the interface normally provides a constructor, which returns an abstract handle to new data, and several operations, which are functions accepting the abstract handle as an argument. 3.3.1 Examples of Abstract Data Type Common abstract data programming languages Queues, Stacks and Trees. types (ADT) typically implemented in (or their libraries) include: Arrays, Lists, www.naarocom.com Page 3

0 What is a Data Structure? A data structure is the implementation of an abstract data type in a particular programming language. Data structures can also be referred to as data aggregate. A carefully chosen data structure will allow the most efficient algorithm to be used. Thus, a well-designed data structure allows a variety of critical operations to be performed using a few resources, both execution time and memory spaces as possible. 23 Classification of Data Structures Data structures are broadly divided into two: Linear Data Structures Non-Linear Data Structures. 0 Linear Data Structures Linear data structures are data structures in which individual data elements are stored and accessed linearly in the computer memory. For the purpose of this course, the following linear data structures would be studied: lists, stacks, queues and arrays in order to determine how information is processed during implementation. 3.5.2 Non-Linear Data Structures A non-linear data structure, as the name implies, is a data structure in which the data items are not stored linearly in the computer memory, but data items can be processed using some techniques or rules. Typical non-linear data structures to be studied in this course are Trees. 0 Data Structures and Programmes The structure of data in the computer is very important in software programmes, especially where the set of data is very large. When data is properly structured and stored in the

computer, the accessibility of data is easier and the software programme routines that make do with the data are made simpler; time and storage spaces are also reduced. In the design of many types of programmes, the choice of data structures is a primary design consideration, as experience in building large systems has shown that the difficulty of implementation and the quality and performance of the final result depends heavily on choosing the best data structure. EXERCISE 1 What are the constituents of a Data Type? Give 2 typical examples of data types.

0 Arrays In Computer Science, an array is a data structure consisting of a group of elements that are accessed by indexing. Each data item of an array is known as an element, and the elements are referenced by a common name known as the array name. In Java, as in most programmeming languages, an array is a structure that holds multiple values of the same type. A Java array is also called an object. An array can contain data of the primitive data types. As it is an object, an array must be declared and instantiated. For example: int[] anarray; anarray = new int[10]; An array can also be created using a shortcut. For example: int[] anarray = {1,2,3,4,5,6,7,8,9,10} An array element can be accessed using an index value. For example: int i = anarray[5] The size of an array can be found using the length attribute. For example: int len = anarray.length Before any array is used in the computer, some memory locations have to be created for storage of the elements. This is often done by using the DIM instruction of BASIC

programming language or DIMENSION instruction of FORTRAN programming language. For example, the instruction: DIM LAGOS (45) will create 45 memory locations for storage of the elements of the array called LAGOS. In most programming languages, each element has the same data type and the array occupies a contiguous area of storage. Most programming languages have a built-in array data type. Some programming languages support array programming which generalises operations and functions to work transparently over arrays as they do with scalars, instead of requiring looping over array members. 0 Declaration of Arrays Variables normally only store a single value but, in some situations, it is useful to have a variable that can store a series of related values - using an array. For example, suppose a programme is required that will calculate the average age among a group of six students. The ages of the students could be stored in six integer variables in C This is a SAMPLE (Few pages have been extracted from the complete notes:-it s meant to show you the topics covered in the full notes and as per the course outline. Download more at our websites: www.naarocom.com

To get the complete notes either in softcopy form or in Hardcopy (printed & Binded) form, contact us on: Call/text/whatsApp +254 719754141/734000520 Email: naarocom@gmail.com info@naarocom.com sales@naarocom.com Get news and updates by liking our page on facebook and follow us on Twitter Sample/preview is NOT FOR SALE