CS1371_Spring_2010_FinalReview_Questions_Solutions

CS1371_Spring_2010_FinalReview_Questions_Solutions - 012 4...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 012 4 507 5 55 55 8 3 26 89 5 5 5 7 5 55 55 5 7 3 57 56 9; :=7?@BC:D7:<F6G> FAI =K<C::BLM =KN< 6 C< 7 :< 6> A 9C6 E EAH C J=7 9CBLMM : B= @9 < 9 =7?@B:<=6< A:;E:BP R:?A =KNAH@<7>D6 UVM WXA=6< 6> A E CE?> :AO< Q > C : B ES<T @ UMM =CE? < = > AC<;E:BY >9 :AO< ZI [ECT? CN6C<AC>A \KNA?] @9 =7?F:<;IA I =VBDOT A 6<6 BC9 ><=C : B7<6 C< 6> ; =C JB6N: :G < D C K< C<=7= :C T A =KNAH@<7>D also length(num)/Fs 9 6> 5500/11000;B% duration, ? CFA<C : > ES<TI = tmax times = linspace(0, tmax, length(num)); plot(times, num) xlabel('Time (s)') ylabel('Amplitude') title('Plot of sound in Time Domain') !#% )*+ - /1 ",. "$&( ", .0 234 [ECT? C<C:C9 ?C@6 QRV6 F9C=N:< OC < `?:?a9=T> 6 A 6<6 ^ETC< ::EKP @E :_ BD? <F<> > > C <6? @ < C<=7?TAI 9 6> B N % Assume it is 3rd and 4th seconds inclusive Fs = 11000; thirdFourth = num(Fs*3:Fs*4); [ECT? CEA<C<=7?6<[Wbcd=<=\II 9B=<==6<CA: A 6<6 := 9 6> > < CN A e :@CN]CE 9= = < P hiQ jk fg P % Instructions are a little unclear. Assume raise % frequency by 2 half steps N = length(num); new = round(linspace(1, N, N/2.^(2/12))); newSound = num(new); [ECT? C=E> C<j m <CE6`LC =A 6AA:B>C\IIDa o]p6< A 6<6 9AG9 l l;T6 C n A C EH>B<H9 A O M ICE < K< = < CAA:;E:BZ rl lI 9=> :AO< q m new = round(linspace(1, N, N*3/5)); skData = data(new); st vxy { u z| &')),( + *. *) 01$23 5 6!7$$ $ 1 !4 $ 8 1 To put 9999999the 9999999of999999999999 on size N 99it9simply, 999efficiency 9999999999999 9 9 9999 99 999999 9 an algorithm based 01$23 51 5 :!!! $1 !4 $ ; 1 O(N^2) 9 < ; 99999N)99999999999999999 $ O(N 99999999999999999999 99log =$! ; 99999999999999999999999 $ 9999999999999999999999 "#> ; 99999N)9-9O(N^2)99999999999 ? O(N9log 9999999 99presorted9999 9 99 9 9999if 99999 2#@$ ; 99999999999999999999999 @ O(N^2)9999999999999999999 999 A'.) BC)DB'-)BGH+)J,BC)D-DC+KHL MNOBPC,K'Q -.' ,+ E*C,F -I* (,+ .,) -' , N+'(C J ( * * H 017!> ?: $$? >6#> 1 $5 > 7>> 5R >$ 7 $ $ 1 6 >$52$ !$$?$$>1T >U16$76 1 S 7>>R1 $ # $ # $$ VWS @ V Y 7> # 1 >> 71 3$> $@$Y 7> # $ X # ? 7 $ $ #$ #35 $? 1 S # ? 71 7> $> 7$ $@$Z1 6#5 1 > 7> 51 $? > 1 S $ $ $1 1 QUICK 7$$ $5 >S #7$1 >!$1 $7> $ > 1 1 $51Y > $ $ 1 1 SORT !5Y 77$: $> 7# 6#1T W 7 V> $>S 1 # $$1 > 1 $ 5 1 S 1 $ $ < 771 > # >$R 7> # $5 X #$ $6# ? 71 > $ INSERTION7 > Y 7 ? 7 $ >R > 1 $ 1 $ #1 # >7 1 1 $ $ $ @S $ > 1 $ $ $ @R SORT 7$$7$Y 77$: 1 > $5>7 ! > 1 7 $S # $$1 > $ 1 R 1 $ $ $> $@$ 1 1 $$ 1 S $ X # # 1 $ 71 #3 3 $? 1 $ # $ $? > $ $ $ @S ? MERGE [ Y 7 ? 7 > > # 5 $> Y $1 > SORT 7Y $ $$ 7 $7$>S #7 7 : S #1 7 1 : : 1Y $$1 $ $ $ 04899 $945 135 4 2 6 31 !"# %$ 024579 7 052 2431 438 94 5942 944 914 135 8 2 4 8 8 911388 5 821 4 0594 21 944 7 943 94 315 21 91 8 14 8 2 4 74 9 8 14 4 2 03 7 31523 09 292143 2 94942 9 9419 7 0 94 984 8 794 721 4 8 74 5 2 29 8 4 ! 7 94 8 1 31 8 5194 8 4 4 4 BUBBLE 9 315 8 519 0 3 492 9 4 8 9 29 0 3 SORT 738 7 51 9415 5 1 2 3 748 759248 8 2 29 4 29 498 5 8"84 2 1 24 2 911 8 8 8 5 1 8479 315 4 514 81 8 94 4 48 29 #$$')$+-. 0(%'202%)4'5'2' 34$)% (* ,$/*),) 3,' ( $1 46$ 1$7 1 * Note: The code here is MERGE SORT 89:;<=>: @ A BCD>E<FGH what is in your textbook. It @ A GI might differ slightly if asked JK A LM:N<OFGHI =8 JK P Q on the exam to ensure your JK@R A 8L>>EFJK S RHI understanding of the 8=EJ< A BCD>E<FGFQ T JK@RHHI JM;>:U A BCD>E<FGFJK@RVQ T JKHHI algorithms. @ A OMLWMED>E< F8=EJ<X JM;>:UHI M:U @ A @YI 89:;<=>: @ A OMLWMED>E<F8=EJ<X JM;>:UH =Q A QI =R A QI >9< A QI ZO=LM F=Q [A LM:N<OF8=EJ<HH \ F=R [A LM:N<OFJM;>:UHH =8 L<F8=EJ<F=QHX JM;>:UF=RHH @F>9<XQH A 8=EJ<F=QHI =Q A =Q V QI MLJM @F>9<XQH A JM;>:UF=RHI =R A =R V QI M:U >9< A >9< V QI M:U ZO=LM =Q [A LM:N<OF8=EJ<H @F>9<XQH A 8=EJ<F=QHI =Q A =Q V QI >9< A >9< V QI M:U ]]]]]]]]]]]]]]]]] 89:;<=>: G A BCD>E<F@H ^ A LM:N<OF@HI E=NO< A ^]QI BUBBLE SORT 8>E =: A QTF^]QH 8>E _: A QTE=NO< =8 F@F_:H P @F_:VQHH <BW A @F_:HI @F_:H A @F_:VQHI @F_:VQH A <BWI M:U M:U E=NO< A E=NO< ] QI M:U G A @I 01234562 8 9 6 48 0 6 46 50 0 6 46 8 9 6 48 0 6 46 QUICK 8 9 6 48 0 6 8 9 6 48 46 2 01234562 8 6 9 6 48 0 6 46 9 80 6 5 9 0 6 9 46 5 5 5 9 5 5 85 5 9 5 2 9 5 8 9 2 50 5 4 9 85 85 9 8 8 9 4 2 2 6 9 01234562 ! 9 6 48 ! 9 INSERTION SORT 5 9 "# 9 2$48 5 5 9 "# ! 9 6 4 ! 85 5 9 5 2 ! 9 !% 01234562 8 9 6 48 & 5 9 "# 9 2$48 62 9 08" 5 5 9 "# 50 4& 85 62 9 4 1 8 9 8'5 & 85'2 41 2 2 5 9 5 2 50 (62 8"# 9 & 2 SORT ...
View Full Document

This note was uploaded on 02/15/2012 for the course CS 1371 taught by Professor Stallworth during the Spring '08 term at Georgia Institute of Technology.

Ask a homework question - tutors are online