tagged [algorithm]
Encoding a number, C# implementation of z-base-32 or something else?
Encoding a number, C# implementation of z-base-32 or something else? I need to encode/decode an integer which is up to 9 digits long but most often 7 digits long. I'd like to make it easier to communi...
Nice & universal way to convert List of items to Tree
Nice & universal way to convert List of items to Tree I have list of categories: ``` ╔════╦═════════════╦═════════════╗ ║ Id ║ Name ║ Parent_id ║ ╠════╬═════════════╬═════════════╣ ║ 1 ║ Sports ...
- Modified
- 19 Aug at 14:45
Finding the second highest number in array
Finding the second highest number in array I'm having difficulty to understand the logic behind the method to find the second highest number in array. The method used is to find the highest in the arr...
How to calculate rounded corners for a polygon?
How to calculate rounded corners for a polygon? I'm looking for an algorithm that allows me to create rounded corners from a polygon. I have an array of points that represents the polygon (outlined in...
- Modified
- 6 Aug at 10:58
Finding the position of the maximum element
Finding the position of the maximum element Is there a standard function that returns the position (not value) of the maximum element of an array of values? For example: Suppose I have an array like t...
Algorithm for intersection of 2 lines?
Algorithm for intersection of 2 lines? I have 2 lines. Both lines containing their 2 points of X and Y. This means they both have length. I see 2 formulas, one using determinants and one using normal ...
- Modified
- 23 Jun at 15:2
Converting a Uniform Distribution to a Normal Distribution
Converting a Uniform Distribution to a Normal Distribution How can I convert a uniform distribution (as most random number generators produce, e.g. between 0.0 and 1.0) into a normal distribution? Wha...
- Modified
- 6 Jun at 20:56
Breadth First Vs Depth First
Breadth First Vs Depth First When Traversing a Tree/Graph what is the difference between Breadth First and Depth first? Any coding or pseudocode examples would be great.
- Modified
- 5 Jun at 17:59
How can building a heap be O(n) time complexity?
How can building a heap be O(n) time complexity? Can someone help explain how can building a heap be complexity? Inserting an item into a heap is , and the insert is repeated n/2 times (the remainder ...
- Modified
- 30 Apr at 15:34
What's the algorithm to calculate aspect ratio?
What's the algorithm to calculate aspect ratio? I plan to use it with JavaScript to crop an image to fit the entire window. : I'll be using a 3rd party component that only accepts the aspect ratio in ...
- Modified
- 24 Apr at 17:34
Find if point lies on line segment
Find if point lies on line segment I have line segment defined by these two points: and . I have point . How can I check if the point lies on the line segment?
Which is better: O(n log n) or O(n^2)
Which is better: O(n log n) or O(n^2) Okay so I have this project I have to do, but I just don't understand it. The thing is, I have 2 algorithms. and . Anyway, I find out in the project info that if ...
- Modified
- 19 Mar at 09:34
How does one make a Zip bomb?
How does one make a Zip bomb? [This question](https://stackoverflow.com/questions/1459080/how-can-i-protect-myself-from-a-zip-bomb) about zip bombs naturally led me to the [Wikipedia page](http://en.w...
- Modified
- 16 Mar at 20:42
Creating a power set of a Sequence
Creating a power set of a Sequence I am trying to create a program that is a base for creating possible combinations of a sequence, string or a number. This is some sort of encryption / decryption pro...
Peak signal detection in realtime timeseries data
Peak signal detection in realtime timeseries data --- The best performing algorithm [is this one](https://stackoverflow.com/questions/22583391/peak-recognition-in-realtime-timeseries-data/22640362#226...
- Modified
- 8 Mar at 18:50
C# - Add watermark to the photo by special way
C# - Add watermark to the photo by special way I need add watermark to the photo by special way. I know how to do it, but I don't know, how to do it the same way as in [this](http://www.photoshopessen...
- Modified
- 23 Feb at 12:54
What is the complexity of the sorted() function?
What is the complexity of the sorted() function? I have a list of lists and I am sorting them using the following Was wondering what is the runtime complexity of this python function?
Standard Normal Distribution z-value function in C#
Standard Normal Distribution z-value function in C# I been looking at the recent blog post by Jeff Atwood on [Alternate Sorting Orders](https://blog.stackoverflow.com/2009/10/alternate-sorting-orders/...
- Modified
- 18 Jan at 12:38
What is the difference between a generative and a discriminative algorithm?
What is the difference between a generative and a discriminative algorithm? What is the difference between a and a algorithm?
- Modified
- 5 Dec at 01:21
HSL to RGB color conversion
HSL to RGB color conversion I am looking for an algorithm to convert between HSL color to RGB. It seems to me that HSL is not very widely used so I am not having much luck searching for a converter.
Construct polygons out of union of many polygons
Construct polygons out of union of many polygons Supposed that I have many polygons, what is the best algorithm to construct a polygon--maybe with holes- out of the union of all those polygons? For my...
- Modified
- 23 Aug at 02:30
How to implement a binary tree?
How to implement a binary tree? Which is the best data structure that can be used to implement a binary tree in Python?
- Modified
- 11 Aug at 06:50
Breadth First Search time complexity analysis
Breadth First Search time complexity analysis The time complexity to go over each adjacent edge of a vertex is, say, `O(N)`, where `N` is number of adjacent edges. So, for `V` numbers of vertices the ...
- Modified
- 9 Aug at 02:58
Is it more efficient to copy a vector by reserving and copying, or by creating and swapping?
Is it more efficient to copy a vector by reserving and copying, or by creating and swapping? I am trying to efficiently make a copy of a vector. I see two possible approaches: ``` std::vector copyVecF...