-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsubmit.py
140 lines (110 loc) · 2.55 KB
/
submit.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# copy and paste your answers into each of the below variables
# NOTE: do NOT rename variables
# Modify the return statements to return the relevant values
# Include 1-2 sentences (as a python comment) above each answer explaining your reasoning.
import math
#Q1ai
io_split_sort =
#Q1aii
merge_arity =
#Q1aiii
merge_passes =
#Q1aiv
merge_pass_1 =
#Q1av
total_io =
#Q1bi
def cost_initial_runs(B, N, P):
# BEGIN YOUR CODE
return 0
# END YOUR CODE
#Q1bii
def cost_per_pass(B, N, P):
# BEGIN YOUR CODE
return 0
#END YOUR CODE
#Q1biii
def num_passes(B, N, P):
# BEGIN YOUR CODE
return 0
# END YOUR CODE
#Q1c
# Save the optimal value here
P =
# Save a list of tuples of (P, io_cost) here, for all feasible P's
points =
#Q2a
IO_Cost_HJ_1 =
IO_Cost_HJ_2 =
IO_Cost_SMJ_1 =
IO_Cost_SMJ_2 =
IO_Cost_BNLJ_1 =
IO_Cost_BNLJ_2 =
#Q2b
P_R =
P_S =
P_T =
P_RS =
P_RST =
B =
HJ_IO_Cost_join1 =
SMJ_IO_Cost_join2 =
SMJ_IO_Cost_join1 =
HJ_IO_Cost_join2 =
#Q3ai
def lru_cost(N, M, B):
# BEGIN YOUR CODE
return 0
#END YOUR CODE
#Q3aii
def mru_cost(N, M, B):
#BEGIN YOUR CODE
return 0
#END YOUR CODE
#Q3aiii
# Provide a list of tuple (m, difference between LRU and MRU in terms of IO cost) here:
p3_lru_points =
#Q3bi
def clock_cost(N, M, B):
#BEGIN YOUR CODE
return 0
#END YOUR CODE
#Q3bii
# Provide a list of tuple (m vs the absolute value of the difference between LRU and CLOCK in terms of IO cost) here:
p3_clock_points =
'''
Explanation here:
'''
#Q4ai
def hashJoin(table1, table2, hashfunction,buckets):
# Parition phase
t1Partition = partitionTable(table1,hashfunction,buckets)
t2Partition = partitionTable(table2,hashfunction,buckets)
# Merge phase
result = []
# ANSWER GOES HERE
# To populate your output you should use the following code(t1Entry and t2Entry are possible var names for tuples)
# result.append((t1Entry.teamname, t1Entry.playername, t2Entry.collegename))
return result
#Q4aii
'''
Explanation here:
'''
#Q4bi
# partition- a table partition as returned by method partitionTable
# return value - a float representing the skew of hash function (i.e. stdev of chefs assigned to each restaurant)
def calculateSkew(partition):
# ANSWER STARTS HERE
skew =
# ANSWER ENDS HERE
return skew
#Q4bii
# Design a better hash function and print the skew difference for
def hBetter(x,buckets):
rawKey = #ANSWER GOES HERE
return rawKey % buckets
#Q4biii
res1 = # ENTER CODE HERE
#speedup here =
#Q4c
flocco_elite =