Q1: What would the bottleneck(s) be in your implementation as you acquire more users? How you might scale your microservice? A: currently, through docker, I have two machines and 5 instances of the website running at the same time. However all these five instance are sharing a single DB(redis) which is configured only in the master machine. This will become an issue as we build up the DB. To overcome this, I would add sharding to split the redis hash to multiple servers.
Q2: How would you improve your deployment process if you needed to maintain this application long term? Automate the deployment process such as creating identical nodes/servers through tools like chef.
Q1: What is the big O notation for your program? [required] A: base on the question, the items in price.txt is already sorted by price from low to high I first read in the txt file line by line which is O(N) with N being the number of items. As I am traversing I pull the information and create vector of items with price. I then use left and right index to travers through the vector which is O(N) again. so the final big O is O(N)
Q2 Bonus Question [optional] You are considering giving gifts to more people. Instead of choosing exactly 2 items, allow for 3 gifts. A: ASSUMING there are at least tree items in the prices.txt I modify the code slightly to include a third item 'i' is used to travers the vector untill vector.size()-2, it represents the first item. left and right are used to represent the remaining two items after 'i'. the big O for this code is O(N^2) As for every i, I traverse its coresponding left and right once