Presentation is loading. Please wait.

Presentation is loading. Please wait.

© 2012 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Problem Solving & Program Design in C Seventh Edition By Jeri R. Hanly.

Similar presentations


Presentation on theme: "© 2012 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Problem Solving & Program Design in C Seventh Edition By Jeri R. Hanly."— Presentation transcript:

1 © 2012 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Problem Solving & Program Design in C Seventh Edition By Jeri R. Hanly & Elliot B. Koffman Chapter 13: Dynamic Data Structures

2 1-2 © 2012 Pearson Addison-Wesley. All rights reserved. 1-2 Figure 13.1 Comparison of Pointer and Nonpointer Variables

3 1-3 © 2012 Pearson Addison-Wesley. All rights reserved. 1-3 Figure 13.2 Function with Pointers as Output Parameters

4 1-4 © 2012 Pearson Addison-Wesley. All rights reserved. 1-4 Figure 13.3 Data Area of a Function with Three Pointer-Type Local Variables

5 1-5 © 2012 Pearson Addison-Wesley. All rights reserved. 1-5 Figure 13.4 Dynamic Allocation of Variables for an int, a char, and a Five-Component planet_t Structure

6 1-6 © 2012 Pearson Addison-Wesley. All rights reserved. 1-6 Figure 13.5 Assignment of Values to Dynamically Allocated Variables

7 1-7 © 2012 Pearson Addison-Wesley. All rights reserved. 1-7 Figure 13.6 Referencing Components of a Dynamically Allocated Structure

8 1-8 © 2012 Pearson Addison-Wesley. All rights reserved. 1-8 Figure 13.7 Allocation of Arrays with calloc

9 1-9 © 2012 Pearson Addison-Wesley. All rights reserved. 1-9 Figure 13.7 Allocation of Arrays with calloc (cont’d)

10 1-10 © 2012 Pearson Addison-Wesley. All rights reserved. 1-10 Figure 13.8 Stack and Heap After Program Fragment in Fig. 13.7

11 1-11 © 2012 Pearson Addison-Wesley. All rights reserved. 1-11 Figure 13.9 Multiple Pointers to a Cell in the Heap

12 1-12 © 2012 Pearson Addison-Wesley. All rights reserved. 1-12 Figure 13.10 Children’s Pop Beads in a Chain

13 1-13 © 2012 Pearson Addison-Wesley. All rights reserved. 1-13 Figure 13.11 Multiple Pointers to the Same Structure

14 1-14 © 2012 Pearson Addison-Wesley. All rights reserved. 1-14 Figure 13.12 Linking Two Nodes

15 1-15 © 2012 Pearson Addison-Wesley. All rights reserved. 1-15 Figure 13.13 Three-Node Linked List with Undefined Final Pointer

16 1-16 © 2012 Pearson Addison-Wesley. All rights reserved. 1-16 Figure 13.14 Three-Element Linked List Accessed Through n1_p

17 1-17 © 2012 Pearson Addison-Wesley. All rights reserved. 1-17 Figure 13.15 Linked List After an Insertion

18 1-18 © 2012 Pearson Addison-Wesley. All rights reserved. 1-18 Figure 13.16 Linked List After a Deletion

19 1-19 © 2012 Pearson Addison-Wesley. All rights reserved. 1-19 Figure 13.17 Function print_list

20 1-20 © 2012 Pearson Addison-Wesley. All rights reserved. 1-20 Figure 13.18 Comparison of Recursive and Iterative List Printing

21 1-21 © 2012 Pearson Addison-Wesley. All rights reserved. 1-21 Figure 13.19 Update of List-Traversing Loop Control Variable

22 1-22 © 2012 Pearson Addison-Wesley. All rights reserved. 1-22 Figure 13.20 Function print_list

23 1-23 © 2012 Pearson Addison-Wesley. All rights reserved. 1-23 Figure 13.21 Iterative Function get_list

24 1-24 © 2012 Pearson Addison-Wesley. All rights reserved. 1-24 Figure 13.22 Function search

25 1-25 © 2012 Pearson Addison-Wesley. All rights reserved. 1-25 Figure 13.23 Linked List Representation of Stacks

26 1-26 © 2012 Pearson Addison-Wesley. All rights reserved. 1-26 Figure 13.24 Structure Types for a Linked List Implementation of a Stack

27 1-27 © 2012 Pearson Addison-Wesley. All rights reserved. 1-27 Figure 13.25 Stack Manipulation with Function push and pop

28 1-28 © 2012 Pearson Addison-Wesley. All rights reserved. 1-28 Figure 13.25 Stack Manipulation with Function push and pop (cont’d)

29 1-29 © 2012 Pearson Addison-Wesley. All rights reserved. 1-29 Figure 13.26 Structure Types for a Linked List Implementation of a Queue

30 1-30 © 2012 Pearson Addison-Wesley. All rights reserved. 1-30 Figure 13.27 A Queue of Passengers in a Ticket Line

31 1-31 © 2012 Pearson Addison-Wesley. All rights reserved. 1-31 Figure 13.28 Creating and maintaining a Queue

32 1-32 © 2012 Pearson Addison-Wesley. All rights reserved. 1-32 Figure 13.28 Creating and maintaining a Queue (cont’d)

33 1-33 © 2012 Pearson Addison-Wesley. All rights reserved. 1-33 Figure 13.29 Functions add_to_q and remove_from-q

34 1-34 © 2012 Pearson Addison-Wesley. All rights reserved. 1-34 Figure 13.29 Functions add_to_q and remove_from-q (cont’d)

35 1-35 © 2012 Pearson Addison-Wesley. All rights reserved. 1-35 Figure 13.30 Addition of One Passenger to a Queue

36 1-36 © 2012 Pearson Addison-Wesley. All rights reserved. 1-36 Figure 13.31 Removal of One Passenger to a Queue

37 1-37 © 2012 Pearson Addison-Wesley. All rights reserved. 1-37 Figure 13.32 Building an Ordered List through Insertions and Deletions

38 1-38 © 2012 Pearson Addison-Wesley. All rights reserved. 1-38 Figure 13.32 Building an Ordered List through Insertions and Deletions (cont’d)

39 1-39 © 2012 Pearson Addison-Wesley. All rights reserved. 1-39 Figure 13.33 Cases for Recursive Function insert_in_order

40 1-40 © 2012 Pearson Addison-Wesley. All rights reserved. 1-40 Figure 13.34 Function Insert and Recursive Function insert_in_order

41 1-41 © 2012 Pearson Addison-Wesley. All rights reserved. 1-41 Figure 13.35 Iterative Function delete

42 1-42 © 2012 Pearson Addison-Wesley. All rights reserved. 1-42 Figure 13.35 Iterative Function delete (cont’d)

43 1-43 © 2012 Pearson Addison-Wesley. All rights reserved. 1-43 Figure 13.36 Function delete Using Recursive Helper Function

44 1-44 © 2012 Pearson Addison-Wesley. All rights reserved. 1-44 Figure 13.37 Recursive Helper Function delete_ ordered_node

45 1-45 © 2012 Pearson Addison-Wesley. All rights reserved. 1-45 Figure 13.38 Binary Tree

46 1-46 © 2012 Pearson Addison-Wesley. All rights reserved. 1-46 Figure 13.39 Binary Tree Search for 42

47 1-47 © 2012 Pearson Addison-Wesley. All rights reserved. 1-47 Figure 13.40 Building a Binary Search Tree

48 1-48 © 2012 Pearson Addison-Wesley. All rights reserved. 1-48 Figure 13.41 Building a Binary Search Tree

49 1-49 © 2012 Pearson Addison-Wesley. All rights reserved. 1-49 Figure 13.41 Building a Binary Search Tree (cont’d)

50 1-50 © 2012 Pearson Addison-Wesley. All rights reserved. 1-50 Figure 13.41 Building a Binary Search Tree (cont’d)


Download ppt "© 2012 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Problem Solving & Program Design in C Seventh Edition By Jeri R. Hanly."

Similar presentations


Ads by Google