Login Form Design using HTML CSS Free Download – Sign in Design | HTML Responsive Web Page
This Tutorial shows you how to make a responsive login form with HTML and CSS. This login page has awesome sunset background. In the login form, we create a wavy transition animation effect that looks the login page attractive. You can learn HTML and CSS by designing a login page by following this video tutorial. It shows step-by-step HTML CSS coding.
Dynamic Programming 6 (Subset Sums, Combinatorics, Decision Problems)
All of the Fibonacci problems we have seen require us to maximize or minimize something. Apart from these, there are some other uses of dynamic programming, one is to find out how a task can be done, another is to solve decision problems (that is, to find out whether a task can be done or not).
Let’s look at the subset sum problem at the beginning. This problem is very similar to the coin change problem, I hope you have read the article about coin change, because this time I will not describe it in such detail as before.
Login Form Design using HTML CSS Free Download – Sign in Design | HTML Responsive Web Page
Subset Sum
You have an integer array C
is given and a value W is given. You have to say how many times W is with the items in C
can be made
For example let C={5,15,3,17,12}
and W=20. We can make 20 in 3 ways -> (5+15),(3+17),(5+3+12)
.
a n
array of size 2n−1
is a non-empty subset. If we use dynamic programming we don’t have to find all the subsets.
Similar to the coin change problem, our subproblem is f(i,W)
, i.e. we want to find out how W takes i to n−1th items
can be made Again we have two choices:
i
Using the th item, the next subproblem is f(i+1,W–C[i])
i
If the th item is not used, the next subproblem is f(i+1,W)
Last time we took the minimum or maximum of two subproblems, this time just add the results of both. The base case will be W=0
, in which case we have reached the target, at which point we need to return 1.
Complexity is also pseudopolynomial O(n∗W) as coin change.
. I show the iterative version, now you can write it yourself.
Subset Sum Decision Problems
Now if you tell us W
No need to figure out how it can be made, just figure out whether W can be made or not. It can be done by using the previous code, the answer is positive means W
can be made But it can be done more easily and using less memory.
In this case we will return boolean true/false instead of returning integer. The result is true if at least one of the two subproblems returns true.
Here || is the logical OR operator.
combination
n to you
There are t items, r items are to be removed from there. How to do it? This is the classic nCr problem that you all read about in high school. Then we memorized a formula for it: n!(n−r)!r!
. Now let’s see how it can be written recursively.
We define a function f(n,r)
. Now you have two choices:
If one item is removed, there will be a total of n−1 left
t item and r−1 more items to be picked, i.e. f(n−1,r−1)
.
If one item is discarded, there will be a total of n−1 left
t items and r more items to be picked, i.e. f(n−1,r)
.
Then we get the answer f(n−1,r−1)
And if f(n−1,r) is added. The formula with basecase would be:
I won’t give you the code, you can write it yourself.
How many ways?
A n∗m to you
A 2D grid of sizes is given. You are currently at the top left corner of the grid (0,0), you need to move from there to cell (n−1,m−1). There are so many different ways to go. You can only go in 3 directions, right, down or around. Some grid cells are blocked and cannot be accessed.
Login Form Design using HTML CSS Free Download – Sign in Design | HTML Responsive Web Page
The 3-direction condition is given so that you cannot return to the same cell again and again, in which case the cycle will be formed, the DAG will not exist.
This problem is very simple. Your subproblem will be f(i,j)
And from here you have 3 choices. You must have understood what the choices are, if you add them, the answer will come out.
Now if we think of this as a decision problem, we want to find out whether the destination can be reached or not. Logical OR will do without adding the answers.
Dynamic Programming 5 (coin change, 0-1 knapsack)
Today we will learn two more classical dynamic programming problems. The first is the coin exchange. As the name of the problem suggests, it is a money splitting problem, you have to split a certain amount of money using the least number of coins.
Think you have n
There are different coins, the values of the coins can be expressed as C0,C1…Cn−1. And you are given an amount W. Now to tell you the minimum number of coins you spend is W
You can make the amount. There is only 1 coin of each value.
Let’s see an example. Let’s say the value of the coins is C={2,5,9,13,15}
money Now if you want to make W=22 with these coins, one way is 15+5+2, in this case 3 coins are needed. But you can use 2 coins to make 22 (9+13) if you want.
. Our target is to minimize coin usage.
Many people try to solve this greedy method in the beginning but it will not work. If you start with the largest coin then the number of coins may not be minimized as seen in the above example.
We will try to create a recursive formula as before. First think what will be the subproblem or state. The order in which the coins should be taken is not specified, but we assume for convenience that we start taking coins from the left side of the array. So the subproblem that naturally comes to mind is what coin we are currently working with. Then our recursive function will be f(i)
. We will try to make W from the ith coin to the n−1th coins.
Now i
With th coin in hand we have two options:
i
Using the th coin, then the next subproblem is f(i+1)
.
i
Moving on to the next coin (i+1) without using the th coin, the next subproblem is f(i+1).
Before Download
You must Join our Facebook Group and Subscribe YouTube Channel
All Links in Below:
Join Our FreeWebsiteCreate Facebook Group to get an instant update for projects, templates, design resources, and solutions.
Join Our YouTube Channel & Subscribe with Bell Icon for New Video:
Join Our Official Facebook Page For the Latest updates All Code Projects are Free:
Visit our service page to get premium services.
Free Website Create – HTML CSS, PHP, JavaScript Programming Projects For Free
Follow Us
Thank You,
Before Download
You must Join our Facebook Group and Subscribe YouTube Channel
FreeWebsiteCreate.net tries to provide HTML, CSS, SCSS, JavaScript, React, Android Studio, Java, PHP, Laravel, Python, Django, C#(C Sharp), and ASP.net-related projects 100% free. We try to make learning easier. Free Website Create always tries to give free projects to new learners. Free projects and source code will help to learn quickly.
They can save time and learn more. In this post, we share a free portfolio project website code with HTML and CSS. This free code portfolio contains a single landing page with a responsive design. In this post, we get a free best carpenter and craftsman service website designed by FreeWebsiteCreate with HTML, CSS, Bootstrap, and JavaScript.