Created
September 19, 2018 15:38
-
-
Save mximenes88/5bf82328bfca9d68210282f66c554733 to your computer and use it in GitHub Desktop.
Algorithms Introduction Checkpoint- Web Development @ Bloc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #### EXERCISES | |
| 1. Using proper pseudo-code, describe the following primitive algorithms: | |
| MAKING COFFEE | |
| FUNCTION makingCoffeeKeurig() | |
| GET Coffee Pod and water | |
| PUT Coffee Pod and water in Keurig | |
| IF Keurig Machine light is not green | |
| WAIT | |
| ELSE | |
| PRESS on button and place a mug on the machine | |
| END IF | |
| FOR EACH cup finished brewing | |
| REMOVE cup from machine | |
| PUT 1 teaspoon of sugar | |
| END FOR | |
| END FUNCTION | |
| ______________________________________________________ | |
| WASHING DISHES | |
| FUNCTION washingDishesDishwasher() | |
| GET dishwasher soap | |
| PUT dishwasher soap in dishwasher | |
| FOR EACH dirty dish on counter | |
| Scrape rest of food into garbage | |
| END FOR | |
| WHILE there is dirty dishes on counter | |
| Place dirty dishes in the dishwasher | |
| END WHILE | |
| TURN on dishwasher | |
| IF dishwasher finished cycle | |
| Remove plates and put in cupboards | |
| END IF | |
| END FUNCTION | |
| __________________________________________________________________________ | |
| PAINTING NAILS | |
| FUNCTION paintingNails() | |
| GET nail polish and nail polish remover | |
| IF nails has old polish | |
| Remove polish with remover | |
| END IF | |
| FOR EACH nail | |
| use 2 coats of paint | |
| END FOR | |
| WHILE polish is not dry | |
| wait 1 minute | |
| END WHILE | |
| END FUNCTION | |
| 2. As with the knot algorithm, there may be more than one way to solve the problem. It is essential to try to pick the best algorithm for a situation. Name three companies who created an algorithm that made them successful, e.g., Google's search algorithm. It doesn't need to be a tech example (such as a recipe or manufacturing a product). Google's algorithm produces more relevant results than other search engines; what about each of your cases make them stand out? | |
| -Uber’s Algorithm: The surge algorithm at Uber aims to balance the supply and demand in certain regions at certain peak usage times. The surge price acts as an additional motivator for drivers during rush times. | |
| -Facebook’s Algorithm: The news feed algorithm prioritizing ‘meaningful interactions’ it’s based on comments, reactions, comment replies, sharing links over Messenger and engagement on shares. This algorithm stands out because it intends to elicit ‘active interactions ‘ instead of just having user passively scroll through the news feed. | |
| =Spotify’s Algorithm: It’s algorithm offer music suggestions based on several factors such as previously downloaded songs and most listened songs for each user. This algorithm allows users to use Spotify to discover new music and bands based on their current interests and listening habits. | |
| 3. Hypothesize about what constitutes an efficient algorithm versus an inefficient algorithm. | |
| The analysis of an algorithm to determinate efficiency is based on time( how long does the algorithm take to complete) and space( how much memory does the algorithm use). This analysis can be done using the Big O notation. Efficient algorithms are also easy to understand and not redundant. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment