Data structure is concerned with the various ways that data files can be organized and assembled. The structures of data files will strongly influence.

Slides:



Advertisements
Similar presentations
Numbers Treasure Hunt Following each question, click on the answer. If correct, the next page will load with a graphic first – these can be used to check.
Advertisements

1 A B C
Simplifications of Context-Free Grammars
Variations of the Turing Machine
Process Description and Control
AP STUDY SESSION 2.
1
Chapter 17 Linked Data Structures. Copyright © 2006 Pearson Addison-Wesley. All rights reserved Learning Objectives Nodes and Linked Lists Creating,
STATISTICS HYPOTHESES TEST (I)
David Burdett May 11, 2004 Package Binding for WS CDL.
Local Customization Chapter 2. Local Customization 2-2 Objectives Customization Considerations Types of Data Elements Location for Locally Defined Data.
Create an Application Title 1Y - Youth Chapter 5.
CALENDAR.
Chapter 6 File Systems 6.1 Files 6.2 Directories
1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,
The 5S numbers game..
1.
Media-Monitoring Final Report April - May 2010 News.
Break Time Remaining 10:00.
Turing Machines.
Table 12.1: Cash Flows to a Cash and Carry Trading Strategy.
PP Test Review Sections 6-1 to 6-6
Chapter 10: Applications of Arrays and the class vector
11 Data Structures Foundations of Computer Science ã Cengage Learning.
Abstract Data Types and Algorithms
1 Linked Lists A linked list is a sequence in which there is a defined order as with any sequence but unlike array and Vector there is no property of.
Briana B. Morrison Adapted from William Collins
1 The Royal Doulton Company The Royal Doulton Company is an English company producing tableware and collectables, dating to Operating originally.
Operating Systems Operating Systems - Winter 2010 Chapter 3 – Input/Output Vrije Universiteit Amsterdam.
Exarte Bezoek aan de Mediacampus Bachelor in de grafische en digitale media April 2014.
Chapter 6 File Systems 6.1 Files 6.2 Directories
Copyright © 2012, Elsevier Inc. All rights Reserved. 1 Chapter 7 Modeling Structure with Blocks.
Adding Up In Chunks.
MaK_Full ahead loaded 1 Alarm Page Directory (F11)
1 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt Synthetic.
Artificial Intelligence
© 2010 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of CHAPTER 11: Priority Queues and Heaps Java Software Structures: Designing.
Before Between After.
Subtraction: Adding UP
: 3 00.
5 minutes.
1 Non Deterministic Automata. 2 Alphabet = Nondeterministic Finite Accepter (NFA)
1 hi at no doifpi me be go we of at be do go hi if me no of pi we Inorder Traversal Inorder traversal. n Visit the left subtree. n Visit the node. n Visit.
Types of selection structures
Speak Up for Safety Dr. Susan Strauss Harassment & Bullying Consultant November 9, 2012.
1 Titre de la diapositive SDMO Industries – Training Département MICS KERYS 09- MICS KERYS – WEBSITE.
Essential Cell Biology
Converting a Fraction to %
Numerical Analysis 1 EE, NCKU Tien-Hao Chang (Darby Chang)
CSE Lecture 17 – Balanced trees
Clock will move after 1 minute
PSSA Preparation.
Physics for Scientists & Engineers, 3rd Edition
Select a time to count down from the clock above
Copyright Tim Morris/St Stephen's School
1.step PMIT start + initial project data input Concept Concept.
1 Dr. Scott Schaefer Least Squares Curves, Rational Representations, Splines and Continuity.
How to create Magic Squares
1 Non Deterministic Automata. 2 Alphabet = Nondeterministic Finite Accepter (NFA)
Bioinformatics Programming 1 EE, NCKU Tien-Hao Chang (Darby Chang)
Chapter 8 Data Abstractions. 2 Chapter 8: Data Abstractions 8.1 Data Structure Fundamentals 8.2 Implementing Data Structures 8.3 A Short Case Study 8.4.
Chapter 8 Data Abstractions Introduction to CS 1 st Semester, 2015 Sanghyun Park.
Chapter 8: Data Abstractions Senem Kumova Metin. 8-2 Chapter 8: Data Abstractions 8.1 Basic Data Structures – Arrays – Lists, Stacks, Queues – Trees 8.2.
Chapter 8 Data Abstractions. © 2005 Pearson Addison-Wesley. All rights reserved 8-2 Chapter 8: Data Abstractions 8.1 Data Structure Fundamentals 8.2 Implementing.
Chapter 8: Data Abstractions
Chapter 8: Data Abstractions
Presentation transcript:

Data structure is concerned with the various ways that data files can be organized and assembled. The structures of data files will strongly influence the selection of a computational strategy for a given data processing job. DATA STRUCTURES

DATA STRUCTERS 1- A List is a collection of sets of data elements. LIST and FILE have the same meaning. 2- Nodes : The sets of data contained in a list are referred to as Node. Each node will contain several related data items. A node is equivalent to a record.

DATA STRUCTERS The items within a node are required to be stored in storage locations, though the nodes themselves need not be adjacent to one another. 3- Field: Each of the items within a given node is said to occupy a field. A field can contain either a data item or a link [or pointer].

DEFINITION 4- The Link [ Pointer]: Contain the starting addresses of other nodes, thus creating a structural interrelationship among the nodes. 4

5 Novels arranged by title but linked according to authorship

DEFINITION The link tell us that the next node in the list has starting address of xxxx. A node need not be restricted to one link, multilinked nodes are common. Each of the nodes in a given list should contain the same number of links. 6

DEFINITION Linear Lists: A linear list is a list which the nodes are ordered in one dimensional arrangement. [ N1, N2, ---, Nr] Sequential linear list When Nodes are stored consecutive adjacent to one another. We refer to the list as sequential linear list.[M/C language, Computer programs, Magnetic tape data files are usually stored in the form of sequential linear list]. 7

LINKED LINEAR LIST Most searching, sorting, and merging operations can be carried out quite easily with sequential linear lists. The simple type of the linked list is the single linked linear list. Each node will contain one pointer, which indicates the starting address of the next node in the list. 8

9 The array of Readings stored in memory starting at address

10 A two-dimensional array with four rows and five columns stored in row major order

11 Names stored in memory as a contiguous list

12 A two-dimensional array with four rows and five columns stored in row major order

13 Names stored in memory as a contiguous list

14 The structure of a linked list

15 Deleting an entry from a linked list

16 Inserting an entry into a linked list

17 A procedure for printing a linked list

MULTIPLE LINKS If each node in the list contains several items, each of which should be ordered in some particular manner, then a different set of links is established for each item. Each set of links establishes a separate single linked linear list. 18

STACKS A stack is a list in which all insertions and deletions are performed at the same end of the structure. Stack known as last-in, first-out [LIFO] structures. 19

BACKTRACKING A classic application of a stack occurs when a program unit requests the execution of a procedure. If the procedure itself request the execution of another procedure, and so on. Stack is an ideal structure for such a system. This process is called Backtracking 20

21 Nested procedures terminating in the opposite order to that in which they were requested

BACKTRACKING Suppose we want to print the names in a linked list in a reverse order that is last name first. We can access the names only by following the link structure. Thus we need to use the stack. 22

23 Using a stack to print a linked list in reverse order (continue d)

24 Using a stack to print a linked list in reverse order

25 A procedure (using an auxiliary stack) for printing a linked list in reverse order

26 A stack in memory

27 Stacks Last-in first-out. Push and pop. Using stacks for maintaining procedure calls. Other applications???

QUEUES Queue is a list in which all insertions are performed at one end while all deletions are made at the other end. The end at which entries are removed is called the Head [ or sometimes the Front] of the queue. The end of the queue at which new entries are added is called the Tail[ or Rear]. 28

QUEUES QUEUE uses two memory cells to use as pointers instead of just one. Head Pointer Tail Pointer 29

30 A queue implemented with head and tail pointers

31 A queue crawling through memory

32 A circular queue (a) containing the letters F through O as actually stored in memory

33 A circular queue (b) in its conceptual form in which the last cell in the block is adjacent to the first cell

34 Queues First-in first-out. Head and tail. Circular queue.

TREES The last Data structure that we will consider is the tree, which is the structure reflected by an organization chart of a typical company. 35

36 An example of an organization chart

TREES Tree consists of a collection of nodes which are interconnected by branches to form a tree like configuration, as shown below: 37

38 Tree terminology

TREES The branches emanate downward from the nodes, The node is presented by a square. The top node is called the root of the tree. All of the remaining nodes are called either branch or terminal nodes. The branch nodes have branches emanating from them, the terminal nodes do not. 39

TREES The degree of a node is equal to the number of sub-trees that emanate from that node. Terminal nodes are therefore nodes of degree zero. All trees have two or more levels. The root is the 1 st level. The subsequent nodes increase in level as they branch out from the root. 40

BINARY TREE It is tree in which each node has at most two children. This trees are stored in memory using a linked structure with two pointer called: Left Child Pointer Right Child Pointer 41

42 The structure of a node in a binary tree

43 The conceptual and actual organization of a binary tree using a linked storage system

44 A tree stored without pointers

BINARY TREE Another alternative storage system The location of a nodes parent can be found by dividing the nodes position in the block by 2 while discarding any remainder [the parent of the node in position 7 would be the node in position 3] 45

BINARY TREES The location of a nodes sibling can be found by adding 1 to the location of a node in even position or subtract 1 from location of a node in an odd position. Node 4 ( 4+1)= 5 Node 3 ( 3- 1 )= 2 46

47 A sparse, unbalanced tree shown in its conceptual form and as it would be stored without pointers

Searching the list If the list were stored according to the linked list model, we would be forced to search the list in sequential fashion, a process could be very inefficient if the list should become long. We will seek an implementation that allows us to use the binary search algorithm. 48

Searching The List To apply this algorithm, our storage system must allows us to find the middle entry of successively smaller portion of the list. This can be done using linked binary tree. Ex. The list of letters [ A, B, C, D, E, F, G, H, I, J, K, L, and M ] 49

50 The letters A through M arranged in an ordered tree

51 The binary search as it would appear if the list were implemented as a linked binary tree

52 The successively smaller trees considered by the procedure in when searching for the letter J

53 Printing a search tree in alphabetical order

54 A procedure for printing the data in a binary tree

55 Inserting the entry M into the list B, E, G, H, J, K, N, P stored as a tree (continued)

56 Inserting the entry M into the list B, E, G, H, J, K, N, P stored as a tree

57 A procedure for inserting a new entry in a list stored as a binary tree

58 Trees Trees - an organization chart; e.g., family tree and companys organization. Root node, leaf nodes, arc, sub trees. Parent, children, siblings. Depth of a tree. Tree implementation. Binary tree.

59 A stack of integers implemented in C++

60 A stack of integers implemented in Java and C#