Algorithms and Data Structures/Algorithms 8

How to Optimize Solutions for Coding Problems

Example: Print all positive integer solutions to the equation a^3 + b^3 = c^3 + d^3 and a, b, c, d are integers between 1 and 1000. 1. A brute force solutions n = 1000 n = 1000 for a from 1 to n for b from 1 to n for c from 1 to n for d from 1 to n if a^3 + b^3 = c^3 + d^3 print a, b, c, d This returns O(n^4) To optimize it we can make a break when we find it n = 1000 for a from 1 to n for b fro..

[MIT 6.006] Algorithmic Thinking & Peak Finding

Efficient Procedures for solving large scale problems Scalability Classical Data Structures Sorting & Matching Real Implementation of Algorithms in Python Order of this classes Algorithmic Thinking: Peak Finding Sorting & Trees: Event simulation Hashing: Genome comparison Numerics: RSA Encryption (SSL | Backend) Graphs: Rubik's Cube Shortest Paths: Caltech -> MIT Dynamic Programming: Image Compr..