Archived

page rank

An old note — I haven't updated it since I wrote it.

Systems design page rank interview.

 1Outdoors
 2  - tents --> 1
 3  - led lights --> 2
 4Electronics
 5  - ipad pro
 6  - bose qc15
 7Gardening
 8  - rake
 9  - wheel barrow
10
11Use it to share thoughts and resources, such as:
12- Features scope
13
14The categories need to be within a set of accepted categories within the company. Products are all sold on the site.
15
16- API design
17
18get_category_names() -> user
19get_items_for_category(cat_id, num, offset) -> user
20
21set_product_category(prod_id, cat_id) -> admin
22
23Messaging, and recieve aggregates for sales totals.
24  once an hour
25  once a day
26  
27sorted data structure -> query products based on aggregate sales value
28      -> heap data structure
29          -> update
30          -> insertion
31          -> deletion
32            -> keeping the products in sorted order
33
34- Pseudo code for specific components
35- Data model/schema
36
37# how to present it in 45 minutes
38# read up on maybe more updated dbs than sql
39
40Categories
41   id: auto # 32
42   name: string # 32
43
44Products_{$category}:
45   id: auto # 32
46   name: string # 32
47   prod_id: int # 32
48   sales_freq: int # 32
49
50Categories:
51  - outdoors
52  - ...
53
54Products_outdoors:
55  - rakes
56  - wheelbarrows
57
58Products_electronics:
59  - ipad
60  - bose
61  - ....
62
63- Back-of-the-envelope calculations
64
6512 million products
666,500,000 UPD
67225 RPS
68
69- Reference links
70- Link to whiteboard or diagram such as https://sketchboard.me/new
  • focus more on presenting the complete picture in 45 minutes, don't waste time
  • do back of the envelope to avoid back and forth
  • think of an appropriate data structure based on query types