Only 3 types:Scalar (start with $)
Array (start with @)
Hashes (start with %)
Basic Hello World program
#!/usr/bin/perl
print "Hello World\n";
Variable In Perl
Scalar
coherent17 changed 8 months agoView mode Like Bookmark
[TOC]
Introduction
為一種解題方法,可以將時間複雜度為exponential time$O(c^n)$優化成polynomial time$O(n^c)$甚至是linear time$O(n)$。那是甚麼樣的問題可以使用dynamic programming呢?要有以下兩種特性的題目才能夠使用dynamic programming的方法來加速。
Optimal Substructure(最佳子結構性質)
We can get optimal solution to the problem by combining the optimal solution by the subproblem.
Overlapping Subproblems(子問題重疊性質)
If you solve the same subproblems many times, then the overlapping property also present.
coherent17 changed 3 years agoView mode Like 2 Bookmark