Download presentation

Presentation is loading. Please wait.

Published byKolby Rendall Modified over 3 years ago

1
Data Structures: A Pseudocode Approach with C 1 Chapter 5 Contd... Objectives Explain the design, use, and operation of a linear list Implement a linear list using a linked list structure Understand the operation of the linear list ADT Application programs using the linear list ADT Design and implement different link-list structures List

2
Data Structures: A Pseudocode Approach with C 2 List Search A list search is used by algorithms to locate data in a list. To insert data, we need to know the logical predecessor to the new data. To delete data, we need to know the node to be deleted and identify it’s logical predecessor. To retrieve data, we need to search the list and find the data. Sequential search is used for list search because there is no physical relationship among the nodes;returns the locations of an element. If not found, returns the location of last element. Given a target key in the ordered list, if a node in the list matches the target value, the search returns true. If no key matches found, it returns false.

3
Data Structures: A Pseudocode Approach with C 3

4
4 List Search contd. Start at the beginning of the list and search until the target value is not greater than the current node’s key. At this point the target is either less than or equal to the current node’s key while the predecessor is pointing to the node immediately before the current nodes. Test the current node and return true if the target value is equal to the list value or false if it is less and terminate the search.

5
Data Structures: A Pseudocode Approach with C 5

6
6 Retrieve Node Retrieve node uses search node to locate the data in the list. If the data are found, it moves the data to the output area in the calling module and returns true. If data are not found, returns false.

7
Data Structures: A Pseudocode Approach with C 7 Empty List A simple module that returns true or false indicating that there are data in the list or the list is empty.

8
Data Structures: A Pseudocode Approach with C 8 Full List As with many other languages, C does not provide how much memory is left in dynamic memory.

9
Data Structures: A Pseudocode Approach with C 9 List Count List count returns the number of nodes in the current nodes.

10
Data Structures: A Pseudocode Approach with C 10 Traverse List Traversal starts at the first node and examines each node in the succession until the last node has been processed. Each loop calls a process module and passes it the data and then advances the walking pointer to the next node. Because we need to remember where we are in the list from one call to the next, we need to add a current position pointer to the head structure. Each call needs to know whether it is starting from the beginning of the list or continuing from the last node processed. This information is communicated through the parameter list.

11
Data Structures: A Pseudocode Approach with C 11

12
Data Structures: A Pseudocode Approach with C 12 Destroy List When the list is no longer needed and the application is not done, the list should be destroyed. Destroy list deletes any nodes still in the list and recycles their memory and set the metadata to a null list condition

13
Data Structures: A Pseudocode Approach with C 13 Implementation We begin with a discussion of the data structure required to support a list. We then develop the 10 basic algorithms required to build and use a list. In developing the insertion and deletion algorithms, we use extensive examples to demonstrate the analytical steps used in developing algorithms. Data Structure Algorithms

14
Data Structures: A Pseudocode Approach with C 14

15
Data Structures: A Pseudocode Approach with C 15

16
Data Structures: A Pseudocode Approach with C 16

17
Data Structures: A Pseudocode Approach with C 17

18
Data Structures: A Pseudocode Approach with C 18

19
Data Structures: A Pseudocode Approach with C 19

20
Data Structures: A Pseudocode Approach with C 20

21
Data Structures: A Pseudocode Approach with C 21

22
Data Structures: A Pseudocode Approach with C 22

23
Data Structures: A Pseudocode Approach with C 23

24
Data Structures: A Pseudocode Approach with C 24

25
Data Structures: A Pseudocode Approach with C 25

26
Data Structures: A Pseudocode Approach with C 26

27
Data Structures: A Pseudocode Approach with C 27

28
Data Structures: A Pseudocode Approach with C 28

29
Data Structures: A Pseudocode Approach with C 29

30
Data Structures: A Pseudocode Approach with C 30

31
Data Structures: A Pseudocode Approach with C 31

32
Data Structures: A Pseudocode Approach with C 32 List ADT example

33
Data Structures: A Pseudocode Approach with C 33

34
Data Structures: A Pseudocode Approach with C 34 (continued)

36
Data Structures: A Pseudocode Approach with C 36

37
Data Structures: A Pseudocode Approach with C 37

38
Data Structures: A Pseudocode Approach with C 38

39
Data Structures: A Pseudocode Approach with C 39

40
Data Structures: A Pseudocode Approach with C 40

41
Data Structures: A Pseudocode Approach with C 41

42
Data Structures: A Pseudocode Approach with C 42

43
Data Structures: A Pseudocode Approach with C 43

44
Data Structures: A Pseudocode Approach with C 44

45
Data Structures: A Pseudocode Approach with C 45

46
Data Structures: A Pseudocode Approach with C 46

47
Data Structures: A Pseudocode Approach with C 47

48
Data Structures: A Pseudocode Approach with C 48

49
Data Structures: A Pseudocode Approach with C 49

50
Data Structures: A Pseudocode Approach with C 50 (continued)

51
Data Structures: A Pseudocode Approach with C 51

52
Data Structures: A Pseudocode Approach with C 52

Similar presentations

OK

Chapter 19: Binary Trees. Objectives In this chapter, you will: – Learn about binary trees – Explore various binary tree traversal algorithms – Organize.

Chapter 19: Binary Trees. Objectives In this chapter, you will: – Learn about binary trees – Explore various binary tree traversal algorithms – Organize.

© 2018 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on regular expression test Ppt on waxes definition Download ppt on conventional and non conventional sources of energy Ppt on vegetarian and non vegetarian relationships Ppt on william harvey experiments on blood circulation Ppt on free cash flow Ppt on video teleconferencing training Ppt on water transport in india Ppt on laser diode Free ppt on green revolution