Exam Flashcards




- Run the jobs in decreasing order of finishing time f_i




Exchange argument
- Does not decrease optimality
- e.g, in EEF, it still contains an disjoint set of intervals when exchanging the leftmost intervals from set O (optimal set) and A (algorithm set)















- Show how to swap
- In case of interval scheduling, swap the two leftmost solutions from optimal and algorithms
- Show how the swap doesnt decrease optimality
- In case of interval scheduling, since the interval has EEF, this does not intersect other intervals in the optimal set, hence its also an optimal solution
OPT(j)= max(v_j + OPT(P(j)), OPT(j -1))
we define PU), for an interval j, to be the
largest index i < j such that intervals i and j are disjoint
Definitions
Give definition of Dynamic programming
- Solve problem by solving sub instance of problem
For a given instance of a problem, we consider certain sub-instances
that grow incrementally. For each of these sub-instances it suffices to keep one optimal solution (because, by an exchange argument, no other solution can lead to a better final solution for the entire instance). The optimal values are then computed step by step on the growing sub-instances. A “recursive” formula specifies how to compute the optimal value from the previously computed optimal values for smaller sub-instances. However, it is not applied recursively, rather, the values are stored in an array, and calculations happen in a for-loop.
What are the topics in the course
- Time complexity, O Notation
- Greedy
- Dynamic programming
- Searching, divide and conquer
- Reduction, NP completness
- DAG’s and graph properties
Give stay ahead argument for Interval scheduling
Algorithm has the option to choose candidate j_r as its solution
Types of greedy problem
- Picking out a subset (interval scheduling)
- Then use exchange argument
- Give an ordering
- Use “swapping” argument where you swap the order of the elements
Unroll the following recurrence 2T(n/2) + O(n)
What are some characteristics of algorithms
- Looping
- Looping through the whole input, O(n) complexity
- No looping in algorithm refers to constant time i.e, O(1)
- Elementary operations
- Arithemtic operations
- If conditions - adding/mdulitplication, querying etc… indexing
- Indexing/querying database or array