1. Trang chủ
  2. » Giáo án - Bài giảng

Bài giảng cấu trúc dữ liệu và giải thuật danh sách liên kết TS đào nam anh

33 95 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 33
Dung lượng 618,69 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Data Structure and Algorithm 1CẤU TRÚC DỮ LIỆU VÀ GIẢI THUẬT Danh sách liên kết Dr.. Data Structure and Algorithm 2Major Reference: • Robert Sedgewick, and Kevin Wayne, “Algorithms” Pri

Trang 1

Data Structure and Algorithm 1

CẤU TRÚC DỮ LIỆU VÀ GIẢI THUẬT

Danh sách liên kết

Dr Dao Nam Anh

Trang 2

Data Structure and Algorithm 2

Major Reference:

• Robert Sedgewick, and Kevin Wayne, “Algorithms”

Princeton University, 2011, Addison Wesley

• Algorithm in C (Parts 1-5 Bundle)- Third Edition by

Robert Sedgewick, Addison-Wesley

• Cấu trúc dữ liệu và giải thuật, Đinh Mạnh Tường.

• Giải thuật và lập trình, Lê Minh Hoàng, Đại Học

Sư Phạm, 2002

Trang 3

Data Structure and Algorithm 3

main() {

int i, N;

for (i = 1, N = 10; i <= 6; i++, N *= 10)

printf(“%7d %2d %9d\n, N, lg(i), N*lg(N)) }

Trang 4

Data Structure and Algorithm 4

• Sử dụng cấu trúc dữ liệu để quản lý tập các dữ

liệu:

 Các thao tác với dữ liệu nào là cần thiết

 Triển khai các thao tác đó như thế nào

• Trong C ta dùng mảng, struct

• Ví dụ mảng trong C:

int A1[N]; int A2[N][M]; char str[50];

» A1[4]? A1[i] = *(A1+i)?

Trang 5

Data Structure and Algorithm 5

Mỗi node có 2 thành phần: phần dữ liệu và phần

liên kết chứa địa chỉ của node kế tiếp hay node

Trang 6

Data Structure and Algorithm 6

 Danh sách liên kết đơn

typedef struct node *link;

struct node {char ch; link next;}

Trang 7

Data Structure and Algorithm 7

• Insert - Chèn

NULL

h

Trang 8

Data Structure and Algorithm 8

• Insert - Chèn

NULL

f h

t x

(t after x)

Trang 9

Data Structure and Algorithm 9

• Insert - Chèn

NULL

f h

t x

(t after x)

Trang 10

Data Structure and Algorithm 10

• Insert - Chèn

NULL

f h

t x

(t after x)

Trang 11

Data Structure and Algorithm 11

• Insert - Chèn

NULL

f h

Trang 12

Data Structure and Algorithm 12

Trang 13

Data Structure and Algorithm 13

Trang 14

Data Structure and Algorithm 14

Trang 15

Data Structure and Algorithm 15

Trang 16

Data Structure and Algorithm 16

• Delete - Xóa

NULL

h

Trang 17

Data Structure and Algorithm 17

Trang 18

Data Structure and Algorithm 18

Trang 19

Data Structure and Algorithm 19

Trang 20

Data Structure and Algorithm 20

Trang 21

Data Structure and Algorithm 21

Trang 22

Data Structure and Algorithm 22

Trang 23

Data Structure and Algorithm 23

Trang 24

Data Structure and Algorithm 24

m g

c b

a h

NULL

Trang 25

Data Structure and Algorithm 25

m g

c b

(delete after h) a

h

NULL

Trang 26

Data Structure and Algorithm 26

f

t

(insert t after x)

m g

c b

e x

a h

NULL

Trang 27

Data Structure and Algorithm 27

f

t

(insert t after x)

m g

c b

e x

a h

NULL

Trang 28

Data Structure and Algorithm 28

f

t

(insert t after x)

m g

c b

e x

a h

NULL

Trang 29

Data Structure and Algorithm 29

f

m g

c b

e a

h

NULL

Trang 30

Data Structure and Algorithm 30

m g

c b

a h

m g

c b

a h

Trang 31

Data Structure and Algorithm 31

m g

c b

a h

m g

c b

a h

Trang 32

Data Structure and Algorithm 32

m g

c b

a h

m g

c b

a h

Trang 33

Data Structure and Algorithm 33

https://sites.google.com/site/daonamanhedu/data-structure-algorithm

Ngày đăng: 06/11/2017, 12:35

TỪ KHÓA LIÊN QUAN

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN

🧩 Sản phẩm bạn có thể quan tâm