! % ! " # ! # $ ! ! " ! & & ' ( ( $ ) * + ( " , " sum = 0, i = 1 while i<=n do begin sum = sum + i i = i + 1 end output sum . / ) # # 2 & . 3 3 3 4 ) 3 +! + 0 0& 0 sum = n*(n+1)/2 output sum & . n sum 1 i & ) " # $ # + 5& / / $ $ . / 7 8 6 & . " # 8 ! ) 8 + % !"# 0 9 % : = ; 00 ; !$# ; ** 0 9 < 8 : ; && ; % ' % ; % % ** & : ; 00 ; 0< ** < 8 : ; && ; & ' ; & - = & ** % - %& %& first = 1 ( ( last = n found = false while (first <= last && found == false) do begin first = 1, last = n, found = false while (first <= last && found == false) do begin mid = (first+last)/2 if (X == a[mid]) found = true else if (X < a[mid]) last = mid-1 else first = mid+1 end if (found == true) report "Found!" else report "Not Found!" ) end if (found == true) report "Found!" else report "Not Found!" ' ( > . 8 . 3 ?& ? @ A ; first=1, last=n found=false while (first <= last && found == false) do begin mid = (first+last)/2 if (X == a[mid]) found = true else if (X < a[mid]) last = mid-1 else first = mid+1 end if (found == true) report "Found" else report "Not Found!" ! " ! ' B " C & & * " "+! * " " , ;DA 4 4 4< 4 4 ;4 4 % @4 *@ 4 ;3 @D @ 4 " ! * 6 " + 3 << + ) + ! ; 4 <6 4 6 E 4 < $ . 0) ( - . # $ - ) <<<<<< ( = <<<<< & & <<<< <<< & & *< 33 << )) ++ 44 *< )) ++44 << << 0) 0) ++ 44 ) ( + ! = ) +4 < +4 ;) A 4 *60 4 4A < ;4 * * 0) @4A 0 6 !; 4 4; ; ) + 4 *< 3 < +4 60 3@ !A 6 !; 3 *) + 4 A 4 30 4 * " $ 0 !A 4 ) ! @3 0 ) #! + " 3 3<<<< 0 6 600 3 3@ @ ;) ;) ++ 44 *) *) ++ 44 !A !A6 6 !;!;3 3 < ; A @ 0 @; A *@ * < ; 0) <;A ;<:@ +4 60 3@ ;) +4 % * ) + ) 2n n2 n log n c n , , !"# 0 $ & " . 0 $ % . & & & ( & " & ! & F & ! , !$# & F . ' ∴ ) , +0 !-# 0 1 $ " * - % .& 1 & . & C = = ' $ " 0 ) +4 3* 3; 39 0 0 ) + = / $0 " ./ # 0 ) + 4 G) ) ++ H F ) + ) +I $ ) + - . 0 ?" 0 0 ; 4 G) 0+ 4 G) + 4 G) 0 3 30 ; 4 G) 0+ 3 0 3* 3 3 0 + 30 @ 3 1 ( ! $ 1 0 ) ' 0 3 30 30 3 <<< 0 @ 0 ; < G) input n sum = n*(n+1)/2 output sum + G) + 3 G) 3* 3 G) 0-2. input n, sum = 0 while i <= n do begin sum = sum + i i = i + 1 end 0-2. output sum <+ 2 + & loc = 1, i = 2 while i <= n do begin if (a[i] < a[loc]) then loc = i i = i + 1 end output a[loc] % 0-2. * ( for i = 1 to 2n do for j = 1 to n do x = x + 1 = = = i = 1 count = 0 while i < n 0-2. begin i = 2 * i count = count + 1 end output count 0-2. )J + < ; A 0 )J + < i . + 0 *& * 0 ; * ; A @ 0 0 ; * ./ . 0 2 345 /! # ∃ ) + 4 G) ) ++ * 0<< (- . ≤ - . << = @<<< *< - . *<<< , *< 9<<< << ;<<< = ) + 0*< K ∀ 3 L * ) ;<< = " (- . ≤ - . ∃ ∃ 1 ) +≤ ∀ K 0<<< *< (- . <<< < <<< < 0< *< 9< :< < 0< *< 9< :< # ) + < << 0<< *<< 9<< :<< << ! # ) + & ) N , ! & , % ≤ ' " + M G) + M G)√ + M G) + M G) 5 506 ∀ 4 & , % G) 0- . ≤ + M G) + M G) + ( , % ∀ 4 * = , % 0- . & ' % ≤ & , % ∀ 4% ≤ * & " & ) N & & ' & & , & ≤ , & , & ≤ & & 0- = N & 0 ∀ 4 . , &≤ & * 7 , & & , & #. & . ∀ 4 & = & , & & ∀ 4& . 0- &. , & & = & & , & 3; 3; & & * ≤ 22 % ≤ 22 % ≤ 22 & , , % 3 & ' 3 ≤ , & ≤ & & ≤ & ∀ 4 . #. ∀ 4& & & , & , & $ % ∀ ∀ ≥2 ∀ ≥2 ∀ ≥2 , % ≤ 22 ∀ ≥2 ∀ ≥2 ∀ * , 0- &. G) 0+ G) + ≤ 22 ≤ 22 ∀ 4% , % !"# &. , ∀ ≥2 0- . #
© Copyright 2026 Paperzz