0% found this document useful (0 votes)
101 views2 pages

Data Structures and Algorithms Midterm Exam

Uploaded by

Hà Hà
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
101 views2 pages

Data Structures and Algorithms Midterm Exam

Uploaded by

Hà Hà
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 2
Dé kiém tra 6n tip nhém 1 - Thoi gi Mg vatens 1 @ Dy Query, 29/9/2003 Naty tuing mim sint M pe bak: 5 Chu 9 digm) Chit y: Vide ih dep + trinh bay rd rang (1 diém) Bai L (1 diém): “Ted Li Dany vdi cdle edu sau kém gia thieh: a) Trong trudng hop tt nhat sip xép Iya chon o6 d6 phire tap la O(NlogN) b) Khi ding caiy hj phan tim kigm dé cai dat Tir din T ( mot phan ti ed d6 pluite tap xdu nit la O(logN) véi N tre MAP) thi phép toan xo s6 phan tr cia T Bai 2 (2 didn Cho pscudo-code, dit ligu vio li ming A 66 dg dai N find_equal(A, N): s0 = 07 i = 0; while (j+1 <.N) and (A[}] >= A(j+1]): j+=17 if (j-i+tl>s0) s0=-j-itl; i= jel return 50 Cho ming A= [1,2,3,2,1,5,3,2, 1, 0) a) Két qui tra vé eda find_equal(A, 10) (1 di bb). Tinh dg phate tap thugt tod theo N (1 diém) Vs 24020850 Email: ledyqrang?S5 gal. com BAL 2 dig): Cho stack S, vali push(x) 1A thém gid tr) x vao S, pop) Wa Liy ra pho tit vd ta ve gid te} vita Ly ra, Tim day gia tr tra vé ca day phép toxin sau: push (Ds pust 2): popdepuash (8): push 1M: popds push{Se ponds ponds push); papOs Pons Bai 4 2 dig): Cho Queue ditge cdi dgt hing danh sch Higa KEt sam, Vidt pseudo cots cho thao tic enqueua(head, x) va daquenuet head), Dainh gia d@ phir tap oda thugt todn, BAIS 2 diém): Cho cdy nj phn tim kgm dusge tao BS chan Lin Iugt ede sf cita ly: 101628 123 1395120 a) V8 cay va tinh chidu cao ctia cay b) In ra danh sich durge duyg thea thir nr preanier Kidm tra cdy ahj phan tim kid o8 13 cy tim kid cain Ning hay Khdng (ly AVL)

You might also like