Skip to content

Latest commit

 

History

History
17 lines (16 loc) · 1.25 KB

README.md

File metadata and controls

17 lines (16 loc) · 1.25 KB

Trinomial triangle

Python 3.7 program that includes the following functionality:

  1. prints trinomial triangle for given LENGTH (height of the triangle)
    (see more https://en.wikipedia.org/wiki/Trinomial_triangle)
please notice, that the asymptotic notation is more than O(LENGTH2), because it is based on the function below
  1. for given LENGTH and TOTAL values returns the list of LENGTH long lists, consisting only of -1, 0 and 1 numbers, which sum is TOTAL
thus the number of all possible variations is a number in the Trinomial triangle
where you can imagine TOTAL horizontal axis (-3, -2, -1, 0, 1, 2, 3) for TOTAL = 3
and LENGTH vertical axis (1, 2, 3, 4, 5) for LENGTH = 5

Use it just by running a program, then you will be able to choose a needed function



Example of trinomial triangle with LENGTH = 5



Number of ways to reach a cell with the minimum number of moves