Skip to content Skip to sidebar Skip to footer
Showing posts with the label Algorithm

Calculating The Factorial Without Trailing Zeros Efficiently?

I'm trying to improve the running time of the factorial calculation of the large number. The fi… Read more Calculating The Factorial Without Trailing Zeros Efficiently?

Minimum Set Cover

I would like to solve a minimum set cover problem of the following sort. All the lists contain on… Read more Minimum Set Cover

Average Of Two Strings In Alphabetical/lexicographical Order

Suppose you take the strings 'a' and 'z' and list all the strings that come between… Read more Average Of Two Strings In Alphabetical/lexicographical Order

Divide And Conquer. Find The Majority Of Element In Array

I am working on a python algorithm to find the most frequent element in the list. def GetFreque… Read more Divide And Conquer. Find The Majority Of Element In Array

Recursion: Make Changes With Fewest Coins

I'm studing the data structure and algorithm in python. Here is the classic problem of recursio… Read more Recursion: Make Changes With Fewest Coins

How To Get The Most Represented Object From An Array

I have an array with some objects, and there are several objects that are alike. E.g: fruit = [appl… Read more How To Get The Most Represented Object From An Array

How To Find The Longest Smallest Path?

A frog wants to cross a river. There are 3 stones in the river she can jump to. She wants to choos… Read more How To Find The Longest Smallest Path?

Algorithm For Filling A Surface Mesh

I have a point cloud which describes a closed surface mesh. I want to create a volume mesh out of t… Read more Algorithm For Filling A Surface Mesh

Detect Period Of Unknown Source

How to detect repeating digits in an infinite sequence? I tried Floyd & Brent detection algorit… Read more Detect Period Of Unknown Source

Combinations From Dictionary With List Values Using Python

I have the following incoming value: variants = { 'debug' : ['on', 'off']… Read more Combinations From Dictionary With List Values Using Python

Optimized Dot Product In Python

The dot product of two n-dimensional vectors u=[u1,u2,...un] and v=[v1,v2,...,vn] is is given by u1… Read more Optimized Dot Product In Python

Algorithm (prob. Solving) Achieving Fastest Runtime

For an algorithm competition training (not homework) we were given this question from a past year. … Read more Algorithm (prob. Solving) Achieving Fastest Runtime

How Does Python Implement Dictionaries?

I was wondering how python dictionaries work under the hood, particularly the dynamic aspect? When … Read more How Does Python Implement Dictionaries?

Recursive Algorithm To Generate All Permutations Of Length K Of A List In Python

I want to create a recursive algorithm that will generate all permutations of a specified length of… Read more Recursive Algorithm To Generate All Permutations Of Length K Of A List In Python

Set Comprehension And Different Comparable Relations

I have set objects which are comparable in some way and I want to remove objects from the set. I th… Read more Set Comprehension And Different Comparable Relations

Python Trie: How To Traverse It To Build List Of All Words?

I have created a trie tree as im learning python, here is the trie output {'a': {'b'… Read more Python Trie: How To Traverse It To Build List Of All Words?

Algorithm For Generating A 3d Hilbert Space-filling Curve In Python

I'd like to map points in a RGB color cube to a one-dimensional list in Python, in a way that m… Read more Algorithm For Generating A 3d Hilbert Space-filling Curve In Python

Fastest Method Of Getting K Smallest Numbers In Unsorted List Of Size N In Python?

What is the fastest method to get the k smallest numbers in an unsorted list of size N using python… Read more Fastest Method Of Getting K Smallest Numbers In Unsorted List Of Size N In Python?

Finding Unique Loops In The Closed Graph

I finally managed to write a code to identify all the loops possible with the current configuration… Read more Finding Unique Loops In The Closed Graph

Python Check String Contains All Characters

I'm reading in a long list of words, and I made a node for every word in the list. Each node ha… Read more Python Check String Contains All Characters