Kinh doanh - Marketing
Kinh tế quản lý
Biểu mẫu - Văn bản
Tài chính - Ngân hàng
Công nghệ thông tin
Tiếng anh ngoại ngữ
Kĩ thuật công nghệ
Khoa học tự nhiên
Khoa học xã hội
Văn hóa nghệ thuật
Sức khỏe - Y tế
Văn bản luật
Nông Lâm Ngư
Kỹ năng mềm
Luận văn - Báo cáo
Giải trí - Thư giãn
Tài liệu phổ thông
Văn mẫu
Tài liệu HOT
Tìm
Danh mục
Kinh doanh - Marketing
Kinh tế quản lý
Biểu mẫu - Văn bản
Tài chính - Ngân hàng
Công nghệ thông tin
Tiếng anh ngoại ngữ
Kĩ thuật công nghệ
Khoa học tự nhiên
Khoa học xã hội
Văn hóa nghệ thuật
Y tế sức khỏe
Văn bản luật
Nông lâm ngư
Kĩ năng mềm
Luận văn - Báo cáo
Giải trí - Thư giãn
Tài liệu phổ thông
Văn mẫu
Thông tin
Điều khoản sử dụng
Quy định bảo mật
Quy chế hoạt động
Chính sách bản quyền
0
Trang chủ
Công Nghệ Thông Tin
Kỹ thuật lập trình
Feaculty of Computer Science and Engineering Department of Computer Scienc Tutorial 3 Questions
TAILIEUCHUNG - Feaculty of Computer Science and Engineering Department of Computer Scienc Tutorial 3 Questions
For each of the AVL trees obtained in Question 1 determine the tree obtained when the root is withdrawn. Question 3. Write a global function in pseudo code to generate an AVL tree from an input list by insert elements in the list into an initial empty AVL. Refer to Question 1 for an example. algorithm generateAVLfromList (val list ) This algorithm generate a AVL from the input list Pre Post the AVL is built by inserting elements in the list into an initial empty tree one-by-one from the beginning. | Faculty of Computer Science and Engineering Department of Computer Science DATA STRUCTURES ALGORITHMS Tutorial 3 Questions Recursion and Binary Tree Part 1. Recursion Required Questions Question 1. What would be the contents of queue Q1 after the following code is executed and the following data are entered 1 Q1 createQueue 2 S1 createStack 3 loop not end of file 1 read number 2 if number not 0 1 pushStack S1 number 3 else 1 popStack S1 x Q1 5 4 6 8 67 32 9 5 2 popStack S1 x 3 loop not empty S1 S1 10 6 20 23 54 1 popStack S1 x 5 2 enqueue Q1 x 4 end loop 4 end if 4 end loop The data are 9 5 10 4 0 5 4 6 8 67 32 25 51 0 54 23 20 6 10 Question 2. The following algorithm is to reverse a queue Algorithm reverse val q Queue Pre true Return a reversed queue of q 1 S createStack 2 Q createQueue 3 while not empty q 1 dequeue q temp 2 pushStack S temp 4 while not empty S 1 popStack S temp 2 enqueu Q temp 4 return Q End reverse Develop a similar algorithm to append a stack to a queue Algorithm append val q Queue val s Stack Pre true Return a reversed queue of q 1 S createStack 2 Q creatQueue 3 while not empty S 1 popStack S temp 2 enqueue q temp 4 reverse Q 5 while not empty q 1 dequeue q temp 2 enqueue Q temp 6 return Q Algorithm append val q Queue val s Stack End append Pre true 1 4 Faculty of Computer Science and Engineering Department of Computer Science Return element of s is appended into q with the same order. For example if q 1 2 3 s 4 5 6 then q 1 2 3 4 5 6 after append. Queue front . rear Stack bottom . top 6 5 4 Question 3. 4 5 6 Consider the following algorithm Algorithm fun1 x integer 1 if x 5 1 return 2 x 2 else 1 return 2 fun1 x - 2 5 3 end if end fun1 What would be returned if fun1 is called as a. fun1 4 8 b. fun1 5 17 c. fun1 8 47 d. fun1 20 2 2 2 anh 3233 Question 4. Develop recursive algorithm for the following problems. Algorithm compute x integer 1 if x 0 1 return 0 a. Compute the sum of all numbers from 1 to n where n is given as parameter. v Algorithm
Tạ Hiền
140
4
pdf
Báo lỗi
Trùng lắp nội dung
Văn hóa đồi trụy
Phản động
Bản quyền
File lỗi
Khác
Upload
Tải xuống
đang nạp các trang xem trước
Bấm vào đây để xem trước nội dung
Tải xuống
TÀI LIỆU LIÊN QUAN
Faculty of Computer Science and Engineering Department of Computer Science - LAB SESSION 3 RECURSION
3
135
0
Faculty of Computer Science and Engineering Department of Computer Science Part 1
4
192
1
Faculty of Computer Science and Engineering Department of Computer Science Part 2
10
108
1
Feaculty of Computer Science and Engineering Department of Computer Scienc Tutorial 3 Questions
4
116
0
Feaculty of Computer Science and Engineering Department of Computer Scienc Tutorial 4 Questions
3
110
0
Lecture Fundamentals of Biochemical engineering
125
61
1
Oregon department of transportation - Digital Signatures for Engineering Documents
10
68
0
REINFORCED ASPHALT OVERLAYS FOR PAVEMENTS - UNIVERSITY OF NOTTINGHAM DEPARTMENT OF CIVIL ENGINEERING
381
70
0
ADVANCED ENGINEERING ENVIRONMENTS Achieving the Vision
58
87
0
Materials Data Book2003 EditionCambridge University Engineering Department
41
64
0
TÀI LIỆU XEM NHIỀU
Một Case Về Hematology (1)
8
461942
55
Giới thiệu :Lập trình mã nguồn mở
14
23112
64
Tiểu luận: Tư tưởng Hồ Chí Minh về xây dựng nhà nước trong sạch vững mạnh
13
10987
531
Câu hỏi và đáp án bài tập tình huống Quản trị học
14
10183
451
Phân tích và làm rõ ý kiến sau: “Bài thơ Tự tình II vừa nói lên bi kịch duyên phận vừa cho thấy khát vọng sống, khát vọng hạnh phúc của Hồ Xuân Hương”
3
9572
106
Ebook Facts and Figures – Basic reading practice: Phần 1 – Đặng Tuấn Anh (Dịch)
249
8385
1132
Tiểu luận: Nội dung tư tưởng Hồ Chí Minh về đạo đức
16
8278
423
Mẫu đơn thông tin ứng viên ngân hàng VIB
8
7889
2228
Đề tài: Dự án kinh doanh thời trang quần áo nữ
17
6836
256
Giáo trình Tư tưởng Hồ Chí Minh - Mạch Quang Thắng (Dành cho bậc ĐH - Không chuyên ngành Lý luận chính trị)
152
6115
1473
TỪ KHÓA LIÊN QUAN
Kỹ thuật lập trình
Engineering Department
Computer Scienc
Feaculty of Computer Science
remove the median element
computer architecture
computer engineering
Lecture Fundamentals of Biochemical engineering
Fundamentals of Biochemical engineering
Biochemical engineering
Chemical engineering department
Anaerobic fermentation processes
Sterilization of microbial medium
Oregon department of transportation
Digital Signatures for Engineering Documents
Electronic Vs Digital Signatures
The Problems with Wet Signatures
Signatures and the Law
Oregon State Law
Reinforcement Materials
Pavement Test Facility
road maintenance
Traffic maintenance
TE Highway engineering
Roads and pavements Civil engineering
composite materials
National Aeronautics
Space Administration
Department of Defense
Department of Energy
Science Foundation
Current State of the Art
Technologes
Systems Engineering
robotic
mechanical
anatomy
data and information
Materials Courses
Engineering Tripos
process data
material property
process attribute charts
Standards and Measuring Devices
electrical engineering curriculum
teaching electronics
electrical systems
electronics engineering
electronic lecture
ESP vocabulary
Simulation task
English for Automotive Engineering
Automotive Engineering Technology Department
Learning ESP vocabulary
Technologies
simple way
lectures
data
objective
litting 2
linked list
object
Lab session 2
objecttive
listing 2
exercises
required excercises
develop method
báo cáo khoa học
báo cáo hóa học
công trình nghiên cứu về hóa học
tài liệu về hóa học
cách trình bày báo cáo
Notarisation
Real estate
Transaction of property
ownership and transfer
portfolio property
Tenancy agreements
TÀI LIỆU MỚI ĐĂNG
Báo cáo nghiên cứu khoa học " KẾT QUẢ NGHIÊN CỨU BƯỚC ĐẦU VỀ THIÊN ĐỊCH CHÂN KHỚP TRÊN CÂY THANH TRÀ Ở THỪA THIÊN HUẾ "
7
190
0
21-05-2024
Công nghiệp gang thép Việt Nam : Một giai đoạn phát triển và chuyển đổi chính sách mới part 5
6
205
0
21-05-2024
Đề tài: Tìm hiểu một số yêu cầu đặt ra với một phòng thu âm, để đảm bảo chất lượng âm thanh trong sản phẩm đa phương tiện
8
171
1
21-05-2024
QUẢN LÝ CHẤT LƯỢNG KHÔNG KHÍ
75
145
0
21-05-2024
XỬ TRÍ CHẤN THƯƠNG SỌ NÃO KÍN
1
124
1
21-05-2024
Truyện kiếm hiệp - Duy ngã độc tôn phần 5/7
1
103
0
21-05-2024
báo cáo hóa học:" Increased androgen receptor expression in serous carcinoma of the ovary is associated with an improved survival"
6
108
0
21-05-2024
Giáo trình phân tích phương trình vi phân viết dưới dạng thuật toán đặc tính của hệ thống p1
5
111
0
21-05-2024
báo cáo hóa học:" Journal of the International AIDS Society: an important step forward"
2
92
0
21-05-2024
Báo cáo khoa học: " Biogeography of Matsucoccus josephi Bodenheimer et Harpaz in Crete and mainland Greece"
6
89
0
21-05-2024
TÀI LIỆU HOT
Mẫu đơn thông tin ứng viên ngân hàng VIB
8
7889
2228
Giáo trình Tư tưởng Hồ Chí Minh - Mạch Quang Thắng (Dành cho bậc ĐH - Không chuyên ngành Lý luận chính trị)
152
6115
1473
Ebook Chào con ba mẹ đã sẵn sàng
112
3788
1255
Ebook Tuyển tập đề bài và bài văn nghị luận xã hội: Phần 1
62
5413
1138
Ebook Facts and Figures – Basic reading practice: Phần 1 – Đặng Tuấn Anh (Dịch)
249
8385
1132
Giáo trình Văn hóa kinh doanh - PGS.TS. Dương Thị Liễu
561
3552
656
Giáo trình Sinh lí học trẻ em: Phần 1 - TS Lê Thanh Vân
122
3757
544
Tiểu luận: Tư tưởng Hồ Chí Minh về xây dựng nhà nước trong sạch vững mạnh
13
10987
531
Giáo trình Pháp luật đại cương: Phần 1 - NXB ĐH Sư Phạm
274
4170
523
Bài tập nhóm quản lý dự án: Dự án xây dựng quán cafe
35
4191
483
Đã 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.