#P = number of Posts P[i][j].timestamp -> where i Person and j the Posting and the timestamp
#N = Number of posts we need (the length for the loops)
# Implement your algorithm . Dont use sorted or sort. Sort by timestamp
def Sort(P, N):
for number_post in range(N):
# Find the lowest Date in List
person = number_post
j = number_post
for i in range(number_post+1, N):
if P[person][j].timestamp > P[person][i].timestamp:
person = i
# If lower swap the Elements in List
temp = P[person][number_post].timestamp
P[person][number_post].timestamp = P[person][i].timestamp
P[person][i].timestamp = temp
#Einfügen in den Newsfeed
S[N] = temp
#S = [P[0][0], P[1][0], P[1][1]]
# TODO end
return S