BlogPost 206

James Messina
3 min readMar 8, 2021

Austin Coding Academy

  1. This week I learned bout APIs and what they are useful for. API’s are application programming interfaces that define interactions between multiple software or mixed hardware-software intermediaries. It defines the kinds of calls or requests that can be made, how to make them, the data formats that should be used, the conventions to follow, etc. I also got better with using classes and their extensions.
  2. The pros of immutability are reduced memory usage, optimization of an application by making use of reference and value equality. Some disadvantages of immutable classes are that they need a separate object for each distinct value. This can be costly.
  3. You can achieve immutability in your code by working with immutable objects. Pure functions have 2 properties: the value it returns is dependent on the input passed and the returned value will not change as long as the inputs do not change. Also, it does not change things outside of its scope (in the global space). Object.assign() is a good method to use because it does not mutate the object passed into it.
  4. Divide and conquer algorithms are algorithm designed paradigms. A divide-and-conquer algorithm recursively breaks down a problem into two or more sub-problems of the same or related type, until these become simple enough to be solved directly. The solutions to the sub-problems are then combined to give a solution to the original problem. The divide-and-conquer technique is the basis of efficient algorithms for many problems, such as sorting ,multiplying large numbers , finding the closest pair of points, syntactic analysis , and computing the discrete Fourier transform.
  5. Insert sort is a sorting algorithm that builds the final sorted array one item at a time. Heap sort is a comparison based sorting algorithm that divides the input into a sorted and unsorted region. Quick sort is an efficient sorting algorithm. Developed by British computer scientist Tony Hoare in 1959 and published in 1961 it is still a commonly used algorithm for sorting. When implemented well, it can be somewhat faster than merge sort and about two or three times faster than heap sort. Merge sort is an efficient, general-purpose, comparison-based sorting algorithm. Most implementations produce a stable sort, which means that the order of equal elements is the same in the input and output.
  6. Insertion sort: best case performance is O(n) comparisons, O(1) swaps and the worst and average cases are О(n2) comparisons and swaps. Worst case space complexity is О(n) total, O(1) auxiliary. Quick sort: best case performance is O(n log n) (simple partition) or O(n) (three-way partition and equal keys and worst case is O(n2). Average performance is O(n log n) and worst case space complexity is O(n) auxiliary (naive)O(log n) auxiliary. Heap sort: Worst and average complexity is n * log(n). Best complexity is n * log(n) and space complexity is 1. Merge sort: same as above but space complexity is n.
  7. A mutable object can be changed after it is created and an immutable object can’t. An example of immutable objects are strings and numbers.
  8. A recursive algorithm must call itself, must have a base case, and must change its state in order to move toward the base case.

--

--