TAILIEUCHUNG - A Laboratory Course in C++Data Structures phần 3

Yêu cầu: Danh sách không có sản phẩm nào. Kết quả: Nếu con trỏ không phải là lúc bắt đầu của một danh sách, sau đó di chuyển con trỏ đến điểm trước trong danh sách và trả về true. Nếu không, trả về false. Điểm getCursor () const | Ordered List ADT 69 Ordered List ADT Data Items The data items in an ordered list are of generic type DataType. Each data item has a key of type char that uniquely identifies the data item. Data items usually include additional data. Type DataType must provide a function called getKey that returns a data item s key. Structure The list data items are stored in ascending order based on their keys. For each list data item E the data item that precedes E has a key that is less than E s key and the data item that follows E has a key that is greater than E s key. At any point in time one data item in any nonempty list is marked using the list s cursor. You travel through the list using operations that change the position of the cursor. Operations List int maxNumber defMaxListSize throw bad_alloc Requirements None Results Constructor. Creates an empty list. Allocates enough memory for a list containing maxNumber data items. List Requirements None Results Destructor. Deallocates frees the memory used to store a list. void insert const DataType newDataItem throw logic_error Requirements List is not full. Results Inserts newDataItem in its appropriate position within a list. If a data item with the same key as newDataItem already exists in the list then updates that data item s nonkey fields with newDataItem s nonkey fields. Moves the cursor to mark newDataItem. 70 Laboratory 4 bool retrieve char searchKey DataType searchDataItem const Requirements None Results Searches a list for the data item with key searchKey. If the data item is found then moves the cursor to the data item copies it to searchDataItem and returns true. Otherwise returns false without moving the cursor and with searchDataItem undefined. void remove throw logic_error Requirements List is not empty. Results Removes the data item marked by the cursor from a list. If the resulting list is not empty then moves the cursor to the data item that followed the deleted data item. If the deleted data item was at the

TỪ KHÓA LIÊN QUAN
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.