Fading Coder

One Final Commit for the Last Sprint

Linear Programming and Greedy Approaches for Sequence Operations

Linear Programming Formulation Let (\cdot) denote the dot product, with (b,c,x,y) as row vectors. For matrix (A), vectors (u,v) satisfy (u \leq v) if (\forall i, u_i \leq v_i), and similar for (\geq). The standard linear programming (LP) problem is: [\max c \cdot x \quad \text{s.t.} \quad \begin{cas...

Dynamic Programming for the Knapsack Problem

Dynamic programming is a technique that decomposes complex problems in to smaller subproblems, avoiding redundant computations and storing data efficiently to solve multi-stage mathematical problems, thereby improving algorithmic efficiency. In algorithm design, dynamic programming includes methods...

Computing All Possible Rainwater Volumes Between Arranged Pillars

Given a set of vertical pillars of integer heights and unit width, we consider arranging them in a line. Rainwater can be trapped between the pillars. The goal is to determine all possible total volumes of trapped rainwater (in unit volumes) achievable across all possible arrangements of the pillars...

Dynamic Programming Solution for the COCI 'Trener' Problem Using String Hashing

The problem requires selecting names of lengths from 1 to N, where each name in a given layer must be formed by adding a single character to the beginning or end of a name from the previous layer. This can be efficient solved using string hashing and dynamic programming. Approach We can compute thre...

Algorithmic Solutions for Selected Problems from the 12th Blue Bridge Cup

B. Determining the Number of Unique Lines in a Grid Given a grid of points defined by coordinates (x, y) where x ranges from 0 to 19 and y ranges from 0 too 20, the objective is to calculate the total number of distinct straight lines that can be formed by connecting any two points. Implementation S...