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.

Slides:



Advertisements
Similar presentations
COL 106 Shweta Agrawal and Amit Kumar
Advertisements

Trees Types and Operations
Data Structures Michael J. Watts
InOrder Traversal Algorithm // InOrder traversal algorithm inOrder(TreeNode n) { if (n != null) { inOrder(n.getLeft()); visit(n) inOrder(n.getRight());
Queues Chapter 6. Chapter Objectives  To learn how to represent a waiting line (queue) and how to use the methods in the Queue interface for insertion.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved L11 (Chapter 20) Lists, Stacks,
Fall 2007CS 2251 Trees Chapter 8. Fall 2007CS 2252 Chapter Objectives To learn how to use a tree to represent a hierarchical organization of information.
Binary Heaps CSE 373 Data Structures Lecture 11. 2/5/03Binary Heaps - Lecture 112 Readings Reading ›Sections
Heaps and heapsort COMP171 Fall Sorting III / Slide 2 Motivating Example 3 jobs have been submitted to a printer in the order A, B, C. Sizes: Job.
Introduction to Data Structure, Spring 2007 Slide- 1 California State University, Fresno Introduction to Data Structure Introduction of Concepts Ming Li.
CS 104 Introduction to Computer Science and Graphics Problems Data Structure & Algorithms (4) Data Structures 11/18/2008 Yang Song.
Chapter 12 C Data Structures Acknowledgment The notes are adapted from those provided by Deitel & Associates, Inc. and Pearson Education Inc.
Queues Chapter 6. Chapter 6: Queues2 Chapter Objectives To learn how to represent a waiting line (queue) and how to use the methods in the Queue interface.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 12 – Data Structures Outline 12.1Introduction.
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.
Trees & Graphs Nell Dale & John Lewis (adaptation by Michael Goldwasser and Erin Chambers)
1 HEAPS & PRIORITY QUEUES Array and Tree implementations.
Copyright © Wondershare Software Introduction to Data Structures Prepared by: Eng. Ahmed & Mohamed Taha.
CHAPTER 71 TREE. Binary Tree A binary tree T is a finite set of one or more nodes such that: (a) T is empty or (b) There is a specially designated node.
Chapter 12 Data Structure Associate Prof. Yuh-Shyan Chen Dept. of Computer Science and Information Engineering National Chung-Cheng University.
Introduction to Data Structures. About the document. The document is prepared by Prof. Shannon Bradshaw at Drew University. The key concepts in data structure.
Introduction to Data Structures. Definition Data structure is representation of the logical relationship existing between individual elements of data.
INTRODUCTION TO MULTIWAY TREES P INTRO - Binary Trees are useful for quick retrieval of items stored in the tree (using linked list) - often,
Priority Queues and Binary Heaps Chapter Trees Some animals are more equal than others A queue is a FIFO data structure the first element.
Binary Trees, Binary Search Trees RIZWAN REHMAN CENTRE FOR COMPUTER STUDIES DIBRUGARH UNIVERSITY.
Heapsort By Pedro Oñate CS-146 Dr. Sin-Min Lee. Overview: Uses a heap as its data structure In-place sorting algorithm – memory efficient Time complexity.
Chapter 11 Heap. Overview ● The heap is a special type of binary tree. ● It may be used either as a priority queue or as a tool for sorting.
Chapter 9 (modified) Abstract Data Types and Algorithms Nell Dale John Lewis.
Chapter 9 Abstract Data Types and Algorithms Nell Dale John Lewis.
9-1 Abstract Data Types Abstract data type A data type whose properties (data and operations) are specified independently of any particular implementation.
COSC 2007 Data Structures II Chapter 15 External Methods.
1 Heaps and Priority Queues Starring: Min Heap Co-Starring: Max Heap.
Data structures Abstract data types Java classes for Data structures and ADTs.
Data Structures and Algorithms Lecture 1 Instructor: Quratulain Date: 1 st Sep, 2009.
Data Structures: Advanced Damian Gordon. Advanced Data Structure We’ll look at: – Linked Lists – Trees – Stacks – Queues.
Data Structures Types of Data Structure Data Structure Operations Examples Choosing Data Structures Data Structures in Alice.
Chapter 16 – Data Structures and Recursion. Data Structures u Built-in –Array –struct u User developed –linked list –stack –queue –tree Lesson 16.1.
Data Structures Chapter 6. Data Structure A data structure is a representation of data and the operations allowed on that data. Examples: 1.Array 2.Record.
Programming Abstractions Cynthia Lee CS106X. Topics:  Priority Queue › Linked List implementation › Heap data structure implementation  TODAY’S TOPICS.
Queues, Stacks and Heaps. Queue List structure using the FIFO process Nodes are removed form the front and added to the back ABDC FrontBack.
CSS446 Spring 2014 Nan Wang.  to study trees and binary trees  to understand how binary search trees can implement sets  to learn how red-black trees.
1 Algorithms Queues, Stacks and Records stored in Linked Lists or Arrays.
FALL 2005CENG 213 Data Structures1 Priority Queues (Heaps) Reference: Chapter 7.
1 M I DAABO COURSE CODE: CSC 355 COURSE TITLE: Data Structures.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To introduce the basic concepts of linked lists ❏ To introduce the basic concepts.
Chapter 9 Abstract Data Types and Algorithms Nell Dale John Lewis.
CPS120: Introduction to Computer Science Nell Dale John Lewis Abstract Data Types.
Nov 2, 2001CSE 373, Autumn Hash Table example marking deleted items + choice of table size.
OCR A Level F453: Data structures and data manipulation Data structures and data manipulation a. explain how static data structures may be.
An Introduction to Programming Using Alice Data Structures.
Mohammed I DAABO COURSE CODE: CSC 355 COURSE TITLE: Data Structures.
Priority Queues and Heaps Tom Przybylinski. Maps ● We have (key,value) pairs, called entries ● We want to store and find/remove arbitrary entries (random.
Partially Ordered Data ,Heap,Binary Heap
Data Structure By Amee Trivedi.
Chapter 12 – Data Structures
Data Structures Michael J. Watts
Top 50 Data Structures Interview Questions
Introduction to Data Structures
Heapsort.
Introduction to Data Structure
Introduction to Data Structures
original list {67, 33,49, 21, 25, 94} pass { } {67 94}
Introduction to Data Structures
ITEC 2620M Introduction to Data Structures
CS Data Structure: Heaps.
An Introduction to Programming Using Alice 2.2, Second Edition
Introduction to Data Structures
Heapsort.
Important Problem Types and Fundamental Data Structures
Data Structures and Algorithm Analysis Priority Queues (Heaps)
Presentation transcript:

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 used data structures include lists, arrays, stacks, queues, heaps, trees, and graphs. Binary Tree 2

DATA STRUCTURES The way in which the data is organized affects the performance of a program for different tasks. Computer programmers decide which data structures to use based on the nature of the data and the processes that need to be performed on that data. Binary Tree 3

EXAMPLE: A QUEUE A queue is an example of commonly used simple data structure. A queue has beginning and end, called the front and back of the queue. Data enters the queue at one end and leaves at the other. Because of this, data exits the queue in the same order in which it enters the queue, like people in a checkout line at a supermarket. 4

EXAMPLE: A BINARY TREE A binary tree is another commonly used data structure. It is organized like an upside down tree. Each spot on the tree, called a node, holds an item of data along with a left pointer and a right pointer. Binary Tree 5

EXAMPLE: A BINARY TREE The pointers are lined up so that the structure forms the upside down tree, with a single node at the top, called the root node, and branches increasing on the left and right as you go down the tree. Binary Tree 6

CHOOSING DATA STRUCTURES By comparing the queue with the binary tree, you can see how the structure of the data affects what can be done efficiently with the data. 7

CHOOSING DATA STRUCTURES A queue is a good data structure to use for storing things that need to be kept in order, such as a set of documents waiting to be printed on a network printer.. 8

CHOOSING DATA STRUCTURES The jobs will be printed in the order in which they are received. Most network print servers maintain such a print queue.. 9

CHOOSING DATA STRUCTURES A binary tree is a good data structure to use for searching sorted data. The middle item from the list is stored in the root node, with lesser items to the left and greater items to the right. 10

CHOOSING DATA STRUCTURES A search begins at the root. The computer either find the data, or moves left or right, depending on the value for which you are searching. Each move down the tree cuts the remaining data in half. 11

CHOOSING DATA STRUCTURES Items can be located very quickly in a tree. Telephone directory assistance information is stored in a tree, so that a name and phone number can be found quickly. 12

CHOOSING DATA STRUCTURES For some applications, a queue is the best data structure to use. For others, a binary tree is better. Programmers choose from among many data structures based on how the data will be used by the program. 13

DATA STRUCTURES IN ALICE Alice has two built-in data structures that can be used to organize data, or to create other data structures: Lists Arrays 14

LISTS A list is an ordered set of data. It is often used to store objects that are to be processed sequentially. A list can be used to create a queue. 15

ARRAYS An array is an indexed set of variables, such as dancer [1], dancer [2], dancer [3],… It is like a set of boxes that hold things. A list is a set of items. An array is a set of variables that each store an item. 16

ARRAYS AND LISTS You can see the difference between arrays and lists when you delete items. 17

ARRAYS AND LISTS In a list, the missing spot is filled in when something is deleted. 18

ARRAYS AND LISTS In an array, an empty variable is left behind when something is deleted. 19

LISTS A list is created in Alice by checking the make a list box when creating a new variable. Make a list box 20

LISTS The For all in order and For all together tiles can be used to work with lists. They are at the bottom of the editor area. 21

ARRAYS Arrays can be created in a similar manner, but more often they are created using the array visualization object from the Alice local gallery. The Array Visualization object has special properties and methods for manipulating the elements in an array. 22

ARRAYS Alice has a set of built-in functions that can be performed on arrays. 23