TAILIEUCHUNG - Lecture Algorithms and data structures (CSC112) - Chapter 24

In computer science, an AVL tree (Georgy Adelson-Velsky and Evgenii Landis' tree, named after the inventors) is a self-balancing binary search tree. This chapter includes contents: Background, define height balancing, maintaining balance within a tree. | Review 1 Array Array Elements Accessing array elements Declaring an array Initializing an array Two-dimensional Array Array of Structure String Array of Strings Examples Queue 2 Queue Operations on Queues A Dequeue Operation An Enqueue Operation Array Implementation Link list Implementation Examples INTRODUCTION A queue is logically a first in first out (FIFO or first come first serve) linear data structure. It is a homogeneous collection of elements in which new elements are added at one end called rear, and the existing elements are deleted from other end called front. The basic operations that can be performed on queue are 1. Insert (or add) an element to the queue (push) 2. Delete (or remove) an element from a queue (pop) Push operation will insert (or add) an element to queue, at the rear end, by incrementing the array index. Pop operation will delete (or remove) from the front end by decrementing the array index and will assign the deleted value to a variable. 3 4 A Graphic Model of a Queue Tail: All new items are added on this end Head: All items are deleted from this end 5 Operations on Queues Insert(item): (also called enqueue) It adds a new item to the tail of the queue Remove( ): (also called delete or dequeue) It deletes the head item of the queue, and returns to the caller. If the queue is already empty, this operation returns NULL getHead( ): Returns the value in the head element of the queue getTail( ): Returns the value in the tail element of the queue isEmpty( ) Returns true if the queue has no items size( ) Returns the number of items in the queue 6 Examples of Queues An electronic mailbox is a queue The ordering is chronological (by arrival time) A waiting line in a store, at a service counter, on a one-lane road Equal-priority processes waiting to run on a processor in a computer system BASIC OPERATIONS ON QUEUE 7 The Queue Operations A queue is like a line of people waiting for a bank teller. The queue has a front and a rear. $ $ Front Rear 8 .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.