Sections 1.5-6 Basic Data Structures. 1.5 Data Structures The way you view and structure the data that your programs manipulate greatly influences your.

Slides:



Advertisements
Similar presentations
Java Card Technology Ch04: Java Card Object
Advertisements

Memory Management Chapter FourteenModern Programming Languages, 2nd ed.1.
CHP-5 LinkedList.
C Structures What is a structure? A structure is a collection of related variables. It may contain variables of many different data types---in contrast.
Dynamic memory allocation
STRING AN EXAMPLE OF REFERENCE DATA TYPE. 2 Primitive Data Types  The eight Java primitive data types are:  byte  short  int  long  float  double.
Primitives, References and Wrappers Java has the following types defined as part of the java language; int float double byte char boolean long short These.
Programming and Data Structure
Dynamic Memory Allocation I Topics Basic representation and alignment (mainly for static memory allocation, main concepts carry over to dynamic memory.
Introduction to Java Objects CSIS 3701: Advanced Object Oriented Programming.
Pointers & Dynamic Memory Allocation Mugurel Ionu Andreica Spring 2012.
Names and Bindings.
CSCI 1100/ , 6.2, 6.4 April 12, 15, 17.
Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Cpt S 122 – Data Structures Data Structures.
Memory allocation CSE 2451 Matt Boggus. sizeof The sizeof unary operator will return the number of bytes reserved for a variable or data type. Determine:
Dynamic memory allocation. The process of allocating memory at run time is known as dynamic memory allocation. C have four library functions for allocating.
Chapter 1 Object Oriented Programming. OOP revolves around the concept of an objects. Objects are crated using the class definition. Programming techniques.
Informática II Prof. Dr. Gustavo Patiño MJ
Lecture - 1 on Data Structures. Prepared by, Jesmin Akhter, Lecturer, IIT,JU Data Type and Data Structure Data type Set of possible values for variables.
1 Day 03 Introduction to C. 2 Memory layout and addresses r s int x = 5, y = 10; float f = 12.5, g = 9.8; char c = ‘r’, d = ‘s’;
Objectives Learn about objects and reference variables Explore how to use predefined methods in a program.
CSE 2501 Review Declaring a variable allocates space for the type of datum it is to store int x; // allocates space for an int int *px; // allocates space.
Chapter 2 Data Design and Implementation. Homework You should have already read section 2.2 You should have already read section 2.2 Read Section 2.3.
Session 1 CS-240 Data Structures Binghamton University Dick Steflik.
Pointers. Addresses in Memory When a variable is declared, enough memory to hold a value of that type is allocated for it at an unused memory location.
CS-341 Dick Steflik Introduction. C++ General purpose programming language A superset of C (except for minor details) provides new flexible ways for defining.
The environment of the computation Declarations introduce names that denote entities. At execution-time, entities are bound to values or to locations:
1 Pointers, Dynamic Data, and Reference Types Review on Pointers Reference Variables Dynamic Memory Allocation –The new operator –The delete operator –Dynamic.
Self Referential Structure. A structure may not contain a member of its own type. struct check { int item; struct check n; // Invalid };
C o n f i d e n t i a l Developed By Nitendra NextHome Subject Name: Data Structure Using C Title: Overview of Data Structure.
Introduction to Java Objects CSIS 3701: Advanced Object Oriented Programming.
Comp 245 Data Structures Linked Lists. An Array Based List Usually is statically allocated; may not use memory efficiently Direct access to data; faster.
Dynamic Memory Allocation The process of allocating memory at run time is known as dynamic memory allocation. C does not Inherently have this facility,
1 © 2002, Cisco Systems, Inc. All rights reserved. Arrays Chapter 7.
Storage Bindings Allocation is the process by which the memory cell or collection of memory cells is assigned to a variable. These cells are taken from.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Chapter 10 - C Structures, Unions, Bit Manipulations,
Basic Semantics Associating meaning with language entities.
12-CRS-0106 REVISED 8 FEB 2013 CSG2H3 Object Oriented Programming.
Chapter 1 Getting Organized. Chapter 1: Getting Organized 1.1 – Software Engineering 1.2 – Object Orientation 1.3 – Classes, Objects, and Applications.
C++ Data Types Structured array struct union class Address pointer reference Simple IntegralFloating char short int long enum float double long double.
1 Dynamic Memory Allocation –The need –malloc/free –Memory Leaks –Dangling Pointers and Garbage Collection Today’s Material.
1 CS 132 Spring 2008 Chapter 3 Pointers and Array-Based Lists read p
Pointers: Basics. 2 What is a pointer? First of all, it is a variable, just like other variables you studied  So it has type, storage etc. Difference:
Chapter 6 Introduction to Defining Classes. Objectives: Design and implement a simple class from user requirements. Organize a program in terms of a view.
Copyright Curt Hill Variables What are they? Why do we need them?
Weeks 5-6 Pointers and Arrays Basic pointer type Pointers and Arrays Address arithmetic Pointer Arrays User-defined data types Structures Unions Pointers.
Pointers in C Computer Organization I 1 August 2009 © McQuain, Feng & Ribbens Memory and Addresses Memory is just a sequence of byte-sized.
+ Dynamic memory allocation. + Introduction We often face situations in programming where the data is dynamics in nature. Consider a list of customers.
Computer Organization and Design Pointers, Arrays and Strings in C Montek Singh Sep 18, 2015 Lab 5 supplement.
Lecture – Pointers1 C++ Pointers Joseph Spring/Bob Dickerson School of Computer Science Operating Systems and Computer Networks Based on notes by Bob Dickerson.
Copyright © 2006 Pearson Addison-Wesley. All rights reserved This Weeks Topics: Pointers (continued)  Modify C-String through a function call 
1 Lecture07: Memory Model 5/2/2012 Slides modified from Yin Lou, Cornell CS2022: Introduction to C.
C LANGUAGE Characteristics of C · Small size
 Variables are nothing but reserved memory locations to store values. This means that when you create a variable you reserve some space in memory. 
Java & C++ Comparisons How important are classes and objects?? What mechanisms exist for input and output?? Are references and pointers the same thing??
ARRAYS IN C/C++ (1-Dimensional & 2-Dimensional) Introduction 1-D 2-D Applications Operations Limitations Conclusion Bibliography.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Linked Lists Outline Introduction Self-Referential Structures.
 Data Type is a basic classification which identifies different types of data.  Data Types helps in: › Determining the possible values of a variable.
Chapter 1 Getting Organized. Waterfall Life-Cycle Model.
RealTimeSystems Lab Jong-Koo, Lim
Object Oriented Programming Lecture 2: BallWorld.
Data Types Chapter 6: Data Types Lectures # 13. Topics Chapter 6: Data Types 2 Introduction Primitive Data Types Character String Types Array Types Associative.
Chapter 5: Enhancing Classes
© 2016 Pearson Education, Ltd. All rights reserved.
Review & Lab assignments
C Programming Lecture-8 Pointers and Memory Management
Java Programming Language
Chapter 3 Introduction to Classes, Objects Methods and Strings
Run-time environments
Dynamic Data Structures
Presentation transcript:

Sections Basic Data Structures

1.5 Data Structures The way you view and structure the data that your programs manipulate greatly influences your success. A language's set of primitive types (Java's are byte, char, short, int, long, float, double, and boolean) are not sufficient, by themselves, for dealing with data that have many parts and complex interrelationships among those parts. Data structures provide this ability.

Implementation Dependent Structures ArrayLinked List

Implementation Independent Structures Sorted List Tree Stack Queue Graph

1.6 Basic Structuring Mechanisms There are two basic structuring mechanisms provided in Java (and many other high level languages) References Arrays

References Are memory addresses Sometimes referred to as links, addresses, or pointers Java uses the reserved word null to indicate an “absence of reference” A variable of a reference (non-primitive) type holds the address of the memory location that holds the value of the variable, rather than the value itself. This has several ramifications …

Assignment Statements

Be aware of aliases

Comparison Statements

Garbage Management Garbage The set of currently unreachable objects Garbage collection The process of finding all unreachable objects and deallocating their storage space Deallocate To return the storage space for an object to the pool of free memory so that it can be reallocated to new objects Dynamic memory management The allocation and deallocation of storage space as needed while an application is executing

Arrays You are already familiar with arrays. The subsection on pages 37 to 41 reviews some of the subtle aspects of using arrays in Java: –they are handled “by reference” –they must be instantiated –initialization lists are supported –you can use arrays of objects –you can use multi-dimensional arrays