Download presentation

Presentation is loading. Please wait.

Published byAlejandro Wintle Modified over 2 years ago

1
ALGORITHMS & DATA STRUCTURES M. Antczak, S. Wąsik

2
Static tables:

3
Character tables (string):

4
Static tables (2):

5
Pointers: Steve Oualline, Practical C Programming, 3rd Edition, OREILLY *first_ptr = *second_ptr = ???? 1111

6
Pointers as Function arguments: & * Const pointers:

7
Pointers as Arrays: Steve Oualline, Practical C Programming, 3rd Edition, OREILLY *array_ptr == array[0] *(array_ptr + 1) == array[1] *(array_ptr + 2) == array[2] … *(array_ptr) + 1 == array[1] NO! *(array_ptr) + 1 == array[0] + 1 OK!

8
Dynamic memory allocation:

9
Dynamic vector & matrix implementation:

10
New element addition: 1)at beginning One direction list: 3) at the end 2) in the middle Selected element deletion: 1)from the beginning 2) from the middle 3) from the end Two direction list:

11
Stack (Last In – First Out)Queue (First In – First Out) New element addition Head element deletion New element addition First element deletion

12
Lets build the Binary Search Tree (BST) based on numbers sequence defined below: 12, 18, 5, 19, 2, 15, 9, 17 <= 12 > L 18<=12 R 18>12 18 L 5<=12 R 5>12 5 L 19<=12 R 19>12 L 19<=18 R 19>18 19 L 2<=12 R 2>12 L 2<=5 R 2>5 2 L 15<=12 R 15>12 L 15<=18 R 15>18 15 L 9<=12 R 9>12 L 9<=5 R 9>5 9 L 17<=12 R 17>12 L 17<=18 R 17>18 L 17<=15 R 17>15 17 BST Searching: Pre-order (wzdłużne): Root, Left Subtree, Right Subtree (R,LS,RS). In-order (poprzeczne): Left Subtree, Root, Right Subtree (LS,R,RS). Post-order (wsteczne): Left Subtree, Right Subtree, Root (LS,RS,R). Pre-order : 12, 5, 2, 9, 18, 15, 17, 19. In-order: 2, 5, 9, 12, 15, 17, 18, 19. Post-order : 2, 9, 5, 17, 15, 19, 18, 12. BST removing (e.g. 18): 1) Maximal node from left subtree MAX=17 2) Minimal node from right subtree MIN=

13
Basic list implementation:

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google