Hacettepe University Department of Computer Science BBM 201 2 Data Structures preparedness Prepared by: blavodbek movatonov 1.4.9: Running time ? 2(lg?(NN0))*b*T 1.4.17: worldly concern static imagineermand program(double[] points, int N){ double hi=0,lo=points[0]; for (int i = 0; i < N; i++){ if (points[i]>hi) hi = points[i]; if (points[i]<lo) lo = points[i]; } StdOut.println(Farthest mates are numbers racket: + lo + + hi); } 1.4.24: ~lgN: national static int floor(int N){ int lo = 0,hi = N,mid(prenominal)(prenominal) = N/2; while (hi>lo){ mid = (hi+lo)/2; if(eggThrownAndBroken(mid) == true) hi = mid - 1; else lo = mid + 1; } hold mid; } Nurkassynov Rassul 20600958 ~2lgF = lgF + lgF: public static int floor(int N){ int lo = 0,hi = 1,mid = 0; while(eggThrownAndBroken(hi) == false){ lo = hi; h i = hi*2; } while (hi>lo){ mid = (hi+lo)/2; if(eggThrownAndBroken(mid) == true) hi = mid - 1; else lo = mid + 1; } tabulator mid; } 1.4.25: ~2?N: public static int floor(int N){ int lo = 0; int x = 2*(int)Math.
sqrt(N); int hi = x; while(eggThrownAndBroken(hi) == false){ lo = hi; x--; hi = hi+x; } while(eggThrownAndBroken(lo) == false) lo++; return lo; } Nurkassynov Rassul 20600958 1.5.5: ((10^6) * 10 * (10^9)) / (24 * 60 * 60 * (10^9)) = 115,74 ? 116 days 1. 5.7: public physical body QuickUnionUF { ! int[] id; int count; public QuickUnionUF(int N) { id = new int[N]; count = N; for (int i = 0; i < N; i++) id[i] = i; } public int find(int p) { while (p != id[p]) p = id[p]; return p; } public Boolean connected(int p, int q) { return find(p) == find(q); } public void union(int...If you command to get a full essay, order it on our website: BestEssayCheap.com
If you want to get a full essay, visit our page: cheap essay
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.