Problem 1
sort 4 numbers from lowest to highest
nums = [4,1,3,2]
for i in range(len(nums)-1):
for j in range(i+1,len(nums)):
if nums[i] > nums[j]:
a = nums[i]
nums[i] = nums[j]
nums[j] = a
print(nums)
[1, 2, 3, 4]
Problem 2
Benefits of simulations:
- Much less expensive than actually conducting the experiments
- Easier to repeat
- Safer to conduct
Drawback of simulations:
Simulations only provide estimated results from models, so conduct experiments will still produce the more accurate results.
Problem 3
Facebook’s News Feed is a prime example of algorithmic enhancement. The News Feed algorithm prioritizes content based on a variety of factors, such as:
-
Relevance: The algorithm predicts what posts are most relevant to the user, based on their past interactions, likes, comments, and shares. This ensures that users see more of what they are interested in, which improves engagement.
-
Timeliness: Posts that are more recent are given priority, as they are considered more likely to be relevant to the user. This keeps the content fresh and timely.
-
Relationships: Content from friends and pages that a user interacts with frequently is prioritized. This means that if you often engage with a friend’s posts or a particular page’s content, you’re more likely to see their posts in your News Feed.
-
Content Type: The algorithm also considers what type of content a user prefers, whether it’s photos, videos, or links. By learning these preferences, the platform can tailor the News Feed to include more of the content type that the user tends to engage with.
-
Engagement: Posts that receive a lot of likes, comments, and shares, especially from the user’s friends, are more likely to appear in the News Feed. This is based on the assumption that high-engagement content is more interesting to users.