代写代考 step1: step2: step3: – cscodehelp代写

step1: step2: step3:
step4: step5: step6: step7:
5,9 261216
3. 24 29 26 element right-left
转旋 行进,衡平不致导, 个一入插上 树子左的 点节右的 在
Inorder -> 14,24,26,29,32,44,91,92,93,94
BF 0,-1, 0,0,0,0,
If there are n nodes in a binary search tree, maximum height of the binary search tree is n-1 and minimum height is ceil(log2n).
Minimum = 10
Maximum = 618
A Full binary tree 0 2 B4
堆根大是这: 为度高: 点节节 或 有树子个一每求要 :
Step1 InitQueue(0) [First] Eject -> 0 Node 0
Inject 1 2 Queue: 1(1), 2(7)
[Second]Eject minimum value-> 1 Node 1
Inject: 3(1+9), 5(1+15)
Queue: 2(7), 3(1+9), 5(1+15)
Use extra memory
H(x) = x mod 11
H = 60 mod 11 = 5 ( 49 ) H’(x) = 7 – (x mod 7) = 3
H’’ = (H + H’) mod 11 = 8 H’(x) = 7 – (x mod 7) = 3
H’’’ = (H’’ + H’) mod 11 = 0 H’’’’ = (H’’’ + H’) mod 11 = 3
True 987654321
Step1: Step2:
Step3: Step4:
23 Answer: 4
23 66(swap with 23)
9 38(swap with 9)
90(swap with 38)
90(swap with 72) 9 38
2: THE_WEATHER_LOOKS_FANTASTIC_TODAY LOOKS(1) THE_WEATHER_LOOKS_FANTASTIC_TODAY
LOOKS(1) THE_WEATHER_LOOKS_FANTASTIC_TODAY
LOOKS(1) THE_WEATHER_LOOKS_FANTASTIC_TODAY
1+1+1+5 = 8
root 0 1 0010000110001010
001-> 0000110001010 0000-> 110001010 11->
0001010 0001->
Answer GRAPH
右往 ,左往 ,始开 从
0,1 cost 12 25
0,1,4 cost 20 19
0,1,4, cost 19 21 2
012345678 cost
0,1,4, cost 2,3
0,1,4, cost 2,3,5
first(0-1) = 8
third(0-2) = 12, fifth(3-5) = 8, sum = 8+12+8 = 28
Answer: MergeSort MergeSort-> B, W, A: nlogn QuickSort->B,A: nlogn, W:n^2 Sort By Counting: B,W, A: n^2 Insertion Sort: B: n, W,A: n^2
Result: Queue:bd Result:a Queue:dcf Result:ab Queue:cfeh Result:abd Queue:fehg Result:abdc Queue:ehg Result:abdcf Queue:hg Result:abdcfe Queue:gi Result:abdcfeh Queue: Result:abdcfehgi
A=2B=3D=1⁄2
快越的排,序无越,排快
Insertion sort O(n) Selection sort O(n^2) Merge sort O(nlogn) QuickSort O(n^2)
It depends on the input data, if input data is more likely to hit the worst case, Algorithm 1 is better, otherwise Algorithm 2 is better.
This Algorithm sort the input and return the median value of the input
A[] = 3,2,4,1,5,7,6,8,9 i=0{
j = i+1 = 1 {
A[1]>A[0] }
A[2]>A[0]? x = 2
x= 8 swap(A[8],A[8]) x=0
j = i+1 = 1 {
A[1]0andb>0returnaorb
DFS: AGBCDFHE
BFS: AGHBCFDE
a=9,b=3,d=2 =>a=b^d O(n^2logn )
a = 2, b = 2, d = 1 => a = b^d O(nlogn )
a = 4, b = 3, d = 2 => a < b^d O(n^2) A2 < A3 < A1 44 mod 13 = 5 51 mod 13 = 12 [70 mod 13 = 5 3 + 70 mod 7 = 3 (3 + 5) mod 13 = 8] 41 mod 13 = 2 26 mod 13 = 0 85 mod 13 = 7 [39 mod 13 = 0 3 + 39 mod 7 = 7 (7 + 0) mod 13 = 7 (7 + 7) mod 13 = 1] 56 mod 13 = 4 0 1 2 3 4 5 6 7 8 9 10 11 12 26 39 41 0 56 44 0 85 70 0 0 0 51 TYRANNOSAURUS SAUR table : [ARSU]=>[2,4,3,1] TYRANNOSAURUS 1 SAUR
TYRANNOSAURUS 1 SAUR
TYRANNOSAURUS 1 SAUR
TYRANNOSAURUS 4 SAUR
Result:91 89 70 10 68 40 60 1 60
89 70 10 68 40
60,89,70,10,68,40,91
60 70 10 68 40
10 60 40 89, 68,70, 10, 60, 40
x -1y<02y>0 function slope(A, n)
return GetSlope(A, 0, n-1)
function GetSlope(A,lo, hi) mid←(lo + hi) / 2
if A[mid].y < 0 and A[mid+1].y > 0
return (A[mid+1].y – A[mid].y)/ (A[mid+1].x – A[mid].x)
if A[mid].y > 0 then
return GetSlope(A, lo, mid)
if A[mid].y < 0 and A[mid+1].y < 0 then return GetSlope(A, mid+1, hi) 的 点和 的 点》件条要必的轴 过穿 function PossibleWay(n) dp← init array with length n+1, all element is 0 dp[0] ←1 for i ←1 to n+1 do for j ← 1 to 4 do if j <= i then return dp[n] Dp[1] = dp[1] + [0] = 1 Dp[2] = dp[2] +dp [1] = 1 } Dp[2] = dp[2] + dp[0] = 2 } Dp[3] = dp[3] +dp [2] = 2 } dp[i] ← dp[i] + dp[i-j] Dp[3] = dp[3] + dp[1] = 3 } Dp[3] = dp[3] + dp[0] = 4 } google-> leetcode

Leave a Reply

Your email address will not be published. Required fields are marked *