This is a Python Program to find the roots of an equation. Problem Description The program takes the coefficients of an equation and finds the roots of the equation. Problem Solution 1. Take in the coefficients of the equation and store it in three separate variables. 2. Find the value of the discriminant, d. 3. … Read more

This is a Python program to print all permutations of a string in lexicographic order using recursion. Problem Description The problem is the display all permutations of a string in lexicographic or dictionary order. Problem Solution 1. The algorithm work by creating a recursive function get_next_permutation that returns the next higher permutation of a sequence … Read more

This is a Python program to print all permutations of a string in lexicographic order without using recursion. Problem Description The problem is the display all permutations of a string in lexicographic or dictionary order. Problem Solution 1. The algorithm work by first creating a loop that will run n! times where n is the … Read more

This is a Python program to minimize maximum lateness using greedy algorithm. Problem Description We are given n requests numbered 0 to n – 1. Each request i has a time that it takes to complete t(i) and a deadline d(i). If a request i starts at time s(i), then its finish time is f(i) … Read more

This is a Python program to find smallest set of unit-length closed intervals that contains all points using greedy algorithm. Problem Description We are given a set of points on the x-axis. We have to find the minimum number of closed intervals of length 1 that will contain all of these points. Problem Solution 1. … Read more

This is a Python program to solve the interval scheduling problem using greedy algorithm. Problem Description In the interval scheduling problem, we are given n activities numbered 0 to n – 1. Each activity i has a start time s(i) and a finish time f(i). Two activities i and j are mutually compatible if s(i) … Read more

This is a Python program to solve the fractional knapsack problem using greedy algorithm. Problem Description In the fractional knapsack problem, we are given a set of n items. Each item i has a value v(i) and a weight w(i) where 0 <= i < n. We are given a maximum weight W. The problem … Read more

This is a Python program to count all paths in an m x n grid with holes using dynamic programming with bottom-up approach. Problem Description We are given an m x n grid, i.e. a grid with m rows and n columns. We are also given a list of holes that the grid has. Each … Read more

This is a Python program to count all paths in an m x n grid with holes using dynamic programming with memoization. Problem Description We are given an m x n grid, i.e. a grid with m rows and n columns. We are also given a list of holes that the grid has. Each hole … Read more

This is a Python program to solve the 0-1 knapsack problem using dynamic programming with top-down approach or memoization. Problem Description In the 0-1 knapsack problem, we are given a set of n items. For each item i, it has a value v(i) and a weight w(i) where 1

advertisement

Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He is Linux Kernel Developer & SAN Architect and is passionate about competency developments in these areas. He lives in Bangalore and delivers focused training sessions to IT professionals in Linux Kernel, Linux Debugging, Linux Device Drivers, Linux Networking, Linux Storage, Advanced C Programming, SAN Storage Technologies, SCSI Internals & Storage Protocols such as iSCSI & Fiber Channel. Stay connected with him @
LinkedIn | Youtube | Instagram | Facebook | Twitter