TAILIEUCHUNG - DATA STRUCTURES IN JAVA A Laboratory Course phần 4

Các nhà xây dựng điểm được gọi trong quá trình thực hiện chương trình. Sau khi được gọi là, các nhà xây dựng PointList phân bổ một mảng của các điểm bằng cách sử dụng nhà điều hành mới của Java. Báo cáo dưới đây, ví dụ như cấp phát bộ nhớ cho một loạt các điểm maxSize. | LABORATORY 5 The new operator allocates memory for a linked list node and calls the StackNode constructor passing both the element to be inserted new Character d and a reference to the next node in the list top . top I d I A -d c I -A -I I d a L--- l Finally the assignment operator assigns the reference to the newly allocated node to top thereby completing the creation and linking of the node. top 1 - - a The methods of the LStack class also implement the operations in the Stack ADT. A reference is maintained to the node at the beginning of the linked list or equivalently the top of the stack. The following incomplete definition for the LStack class is given in the file . class LStack implements Stack Data member private StackNode top Linked stack class Reference to top of stack Constructors and helper method setup public LStack public LStack int size Default Constructorl Constructor2 ignore size for compatibility with AStack Class methods private void setup Called by Constructors only Insert method implementations for the interface Stack here class LStack Step 3 Implement the operations in the StackNode ADT and the LStack ADT using a singly linked list to store the stack elements. Each node in the linked list should contain a stack element element and a reference to the node containing the next element in the stack next . Your implementation also should maintain a reference to the node containing the topmost element in the stack top . Base your implementation on the incomplete class definitions in the files and . 112 LABORATORY 5 Step 4 Save your linked list implementation of the LStack ADT in the file and of the StackNode ADT in the file . Be sure to document your code. 113 LABORATORY 5 LABORATORY 5 Bridge Exercise Name Hour Period Section Date Check with your instructor as to whether you are to complete this exercise

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.