14,970,270 members
Everything / General Programming / Algorithms

# Algorithms

algorithm

by
In this article we'll demonstrate the implementation of k-means clustering algorithm to produce recommendations.
by
Development in C# without care of resource consumption can lead to overloading the system. This article describes a case with large waste of memory and CPU time and how to avoid it.
by
A small simulator for a 6 axis articulated robot
by
This article demonstrates the development of code in C# implementing famous k-means clustering algorithm to perform graphical raster image segmentation.

## Latest Articles

by
In this post I implement a Density Matrix Renormalization Group program.
by
Has many ways applications can sample using an underlying (pseudo-)random number generator and includes pseudocode for many of them.
by
In this article I’ll explain how to perform the alignment based on the face landmarks the detector has found.
by
Welcome to our Comparison on Sorting Algorithms Article. Here, we'll be comparing the various sorting Algorithms out there on the basic of several factors.

## All Articles

### Algorithms

25 Dec 2016
In this article we'll demonstrate the implementation of k-means clustering algorithm to produce recommendations.
28 Aug 2015
Development in C# without care of resource consumption can lead to overloading the system. This article describes a case with large waste of memory and CPU time and how to avoid it.
7 Apr 2014
A small simulator for a 6 axis articulated robot
29 Aug 2017
This article demonstrates the development of code in C# implementing famous k-means clustering algorithm to perform graphical raster image segmentation.
26 Apr 2018
Best practice for opinion and Text Mining based on Naïve Bayesian Classifier.
8 Apr 2020
Implementation of the Poisson Cumulative Distribution function for large Lambdas
7 Sep 2010
This article presents an algorithm and data structures to implement auto-tiling as seen in RPG Maker, the Starcraft level editor, etc.
17 Feb 2015
Educational software package for Microsoft Windows® 7/8 contains “5-in-1” School Math Calculators and Equation Solvers intended for students and educators
6 Sep 2016
An articial life algorithm that attempts to solve a problem by flying a swarm of entities through a range of possible solutions where each entity is guided by the performance of other members of the swarm
1 Jun 2018
Comprehensive unit parsing library
27 Nov 2017
An infinite set of biological shape fractals in the complex plain
13 Oct 2013
A simple, portable yet efficient Quicksort implementation in C
22 Apr 2016
C# code for a low-pass Butterworth filter is presented
9 Sep 2018
Finding a fundamental Cycle Set forming a complete basis to enumerate all cycles of a given undirected graph
30 Dec 2018
In this article, we will demonstrate how to compute full SVD of a given matrix A and discuss about the code in C++11 implementing the full SVD computation by using simple iteration and Jordan-Gaussian methods.
27 Jun 2021
How to build an AI which plays Backgammon
27 Oct 2015
A faster method for performing interval arithmetic
13 Mar 2019
Any deterministic game can be broken down to its core functionalities. By understanding them, one can implement fundamental algorithms such as Minimax (with alpha beta pruning), thus paving the way towards a better AI opponent.
7 Jun 2016
cobj is a preprocessor based generator for interface based polymorphism
4 Sep 2020
Logistic regression, back propagation and support vector machine in comparison on the Iris data set
10 Oct 2020
An optimization programming technique
26 Oct 2014
A 2D/3D force directed graph algorithm in C#
20 Jun 2021
Pandemic SEIR and SEIRV modelling software and infrastructure for the Corona SARS-COV-2 COVID-19 disease with data from Johns-Hopkins-University CSSE, Robert Koch-Institute and vaccination data from Our World In Data.
29 Sep 2013
Transfering subtitle synchronization from one subtitle file to another
18 Aug 2014
Some suggestions of algorithms for solving the Pascal Triangle, addressing iterative, recursive and functional paradigms
10 Nov 2014
This is how to use the bisection method to calculate the nth root of a positive real number.
29 Aug 2015
The traditional way to solve the ZigZag Conversion problem is to either build a 2d table or find a pattern among the index of the letters on the same row. There is also a beautiful solution which builds on top of Breadth First Search. Continue reading..
26 Nov 2018
Clarifying the use of multi-pass filter cutoff correction
25 Nov 2018
What performance can we get from C++17 parallel algorithms?
30 Apr 2021
An alternative method to Catmull-Rom, Chaikin or Bezier curve smoothing methods
31 Jul 2012
How to calculate a reverbration time in a room
13 Dec 2014
I prefer to encapsulate the status and access to it.The idea behind this: since the string is already grouped or sorted by characters, we can traverse the string from left to right and maintain a current state (which character with how many instances at that point). If the number of character...
26 Mar 2015
This tip describes a n ary tree structure.
4 Mar 2016
27 Apr 2018
In this article, we will formulate and discuss CLOPE data mining clustering algorithm that allows to drastically increase the quality and efficiency of categorized data clustering and can be easily used for recommendation-specific purposes
11 Apr 2019
Word-making game!
13 Mar 2021
Algorithms to turn biased "coin flips" into biased "coin flips", and how to code them.
14 Jun 2012
Please see my comment to the question. You need to specify your application type or UI library you want to use. If you don't have preference, you should tell us about it, as "what would you advise".Now, very clear tutorial is &mdash; on what topic? Don't expect and look for tutorials on...
20 Jan 2013
Hello Chona1171, A most common solution algorithm for your problem is to use the Dijkstra's Algorithm.Click to read about Dijkstra's AlgorithmThere's this nice article in CodeProject:C# - Visualizing Path Finding With Dijkstra, AStar, Bi-directional Dijkstra's, and Bi-directional...
19 May 2014
8 Feb 2015
How to apply GA techniques fo solving problems in VB.NET. The example shows how to create solutions for a 2D maze, which will evolve to find the shortest path between two points.
16 Dec 2015
Using text retrieval TF-IDF technique to rank tokens in a text document
26 Apr 2021
How well does the Interpolation of Colors match the Colors produced by Microsoft's Linear Gradient Brush?
14 Jun 2021
This article revises an earlier revision of the Gradient Color Picker (V2). The incentive for the revision was a reader request for a larger number of initial color choices.
19 Jul 2021N
Welcome to our Comparison on Sorting Algorithms Article. Here, we'll be comparing the various sorting Algorithms out there on the basic of several factors.
10 Aug 2010
Understanding of Example Based Machine Translation (EBMT) system and how to create your own using exisiting tools
31 Jan 2011
Steps as above (Answer 1) - however, you could use a ListView instead of a listbox. Set the "view" property to "details" though! Add a ListViewItem for the e.g. ID and to that ListViewItem, add a subitem for the Address.Hope I'm not too wide of the mark here!
14 Jun 2012
Most likely you can use the Graph# library[^].Best regardsEspen Harlinn
14 Jun 2012
20 Jun 2012
This is an alternative for "Converting Postfix Expressions to Infix"
5 Nov 2012
OK - look at it in parts: srand((unsigned) time(NULL));Initialises a random number generator. const int passLen = 10; for (int i = 0; i
22 Jan 2014
The best algorithm for storing passwords is not storing any passwords; this is unsafe and absolutely not needed for authentication.Surprised, disagree? Please see my past answers:i already encrypt my password but when i log in it gives me an error. how can decrypte it[^],Decryption of...
12 Dec 2014
Arrays are zero-based; by starting with i = 1 you skip one element. And by using c.Length - 1, you also skip the last element. You also don't need to store the whole list, you can store only the longest. It's also better to use StringBuilder than string concatenation. And the temp =...
16 Feb 2015
Evaluation order matters!
20 Oct 2015
I just realized that this is very similar to the well-known Knapsack problem, only you don't need to find the optimal solution, just need to list them all: https://en.wikipedia.org/wiki/Knapsack_problem[^].From this article, you can find the overview of known solutions. Not all of them will...
24 May 2020
Application to show how to zigzag order a matrix
29 Jul 2017
How to create an ASP.NET control for image resizer and cropper keeping aspect ratio
2 Dec 2017
Library extending the .NET numeric support
20 Jul 2019
The audience of this article's readers will find out how to perform association rules learning (ARL) by using FPGrowth algorithm, that serves as an alternative to the famous Apriori and ECLAT algorithms.
19 Aug 2020
In this article we create a web app that trains the classifier on the go and recognizes grumpy facial expressions.
11 Apr 2021
Python code for partially-sampled random numbers for accurate arbitrary-precision sampling
18 May 2010
Algorithm to convert Arabic Numbers to Arabic Text using C#
7 Nov 2010
You could always take a look at a project such as this[^] for sample code and projects to help you.
19 Dec 2010
Yes, it will do.Because all you check for in the loop guard is "nums[i]
1 Mar 2011
22 Sep 2011
Private key is never sent; it would defeat the purpose of public-key security. You can exchange information with anyone even if someone spies on your connection all the time. You send public key to your partner. The public key is used to encrypt and cannot decrypt, you keep your private key...
29 Nov 2011
This is your graduation work. How can you demand a serious answer? Sorry, you cannot even correctly pose the problem and do not look competent in your own graduation work but want to get a credit (and a diploma!) for that. How are you going to make one of the experts interested in helping you?...
6 Feb 2012
Have a look at:WPF: A* search[^]It does most of what you actually need. Best regardsEspen Harlinn
20 Feb 2012
As a developer who has spent a fair amount of time tweaking code for performance optimization, I'm having some issues with this article.First of all, who has generally accepted 10M iterations to test the performance? Unless your native code happens to be calling a function thousands or...
6 Apr 2012
Here are some algorithm books.Data Structures and Algorithm Analysis(C++)[^]Data Structures and Algorithm Analysis(Java)[^]Data Structures and Algorithms[^]You can get a free book from here.http://freecomputerbooks.com/[^]
4 Sep 2013
You would never want to use another photo editor in your AIO again
12 Dec 2014
I'd suggest to read this thread: Counting A Character[^].I do not see any performance issues by using Linq, unless the set of strings is very, very LARGE.It's really fast. Below query is executed in 0.001 sec.string input = "aaaabbcddddddddddeeffffg";var qry = (from c in input group...
12 Dec 2014
Given the fact that the string is an ordered sequence, this gets very easy[1] to do with Linq:string test = @"aaaabbcddddddddddeeffffg";var longestGroup = test.GroupBy(ch => ch).OrderByDescending(grp => grp.Count()).First();char longestChar = longestGroup.Key;int...
3 Feb 2015
Here is the code of my approach:int max(int A, int B, int C){ return Math.Max(A, Math.Max(B,C));}void Main(){ var e = new byte[] {5,6,1,4,9,3,1,2}; var i=0; var j = e.Length-1; int A = e[i]; int C = e[j]; int B = 0; for(int x = i+1 ; x
14 Aug 2015
15 Sep 2015
Smart pointers implementation in C
29 Sep 2015
After I read all the comments I feel tempted to give this basic problem a try. So, if I understand the problem correctly, the number of aliens living on day n is the number of aliens of the previous day (nobody dies) plus the number of eggs that hatch on this day. The latter is equal to the...
11 Oct 2015
To answer your last two questions first:Yes.And Yes.The trouble is that this is a complicated area, and it's difficult to explain why algorithms are important in a small text box.There is a relationship between algorithms and programming, but it's not always obvious because an...
14 Dec 2016
Graph intersection using map reduce and Akka
29 Nov 2016
Adding tools to help estimate the correct delay and embedding dimension
6 Feb 2019
Computational classes and a GUI interface to illustrate usage
28 May 2020
In an adjacency matrix of a graph, a value of zero means that there is no edge between corresponding vertices. For example, in the matrix you have shown, note that the values in the diagonal are all zeroes, because there is no loop edge on any...
1 Sep 2020
This is not a programming question. It's about finding an algorithm that gives you a correct result. Additionally it may be about finding an algorithm that gives you the result quickly, but you didn't say that. Either way, you might get more...
22 Nov 2020
A look into graph based algorithm
25 Apr 2010
Hi, I have to detect repetitions in signal data (carrier-modulated digital signal) which looks similar that 10101010 0001010000001010 0001010000001010 0001010000001010 0101010000000000(spaces just for human-readability :-D )As you can see, the 0001010000001010 pattern repeats. Can you...
28 Apr 2010
Josh Gray wrote:* Is there likely to be a tangible benefit to doing this or would a compiler (gcc in my case) make this optimisation?VC++ compiler takes care of such optimization (I see no div operation).I guess gcc do the same, you may verify it using the -S switch and looking at the...
19 Dec 2010
Hi Arash,the line that reads int temp = i;should most probably read like int temp = num[i];because i and j are indexes and what you're trying to accomplish withthe variable named temp is swapping of the array element num[i] with num[j].That's the problem I see with your...
23 Jan 2011
Why not just use lhs==rhs? Vectors have an operator==.
19 Feb 2011
Hi,A detailed explanation of Bayes theorem is hereBayesian Example implementations are hereA Naive Bayesian Spam Filter for C#[^]A Naive Bayesian Classifier in C#[^]
4 Mar 2011
I'd say have a look at Autotune.Nethttp://channel9.msdn.com/coding4fun/articles/AutotuneNET[^]As you'll see, pitch detection is obviously vital to an autotune program, so that will help you with what you're trying to do.
18 Mar 2011
This little elaboration will help you along the way: http://www.euclideanspace.com/maths/geometry/affine/aroundPoint/index.htm[^].It shows how to combine the rotation matrices with a translation to achieve the rotation about a given point. The page you found gives you the rotation matrices for...
23 Mar 2011
No.You first have to define "best": Best for a sort algorithm might be "fastest": but even then "fastest" will depend on data - if you know the data has a particular pattern, then the "fastest" general algorithm may not be the quickest to sort the specific data.
24 Mar 2011
If there are open-source implmentations available, and there usually are - test that each of them is capable of correct behaviour - sometimes some algorithms are not able to evaluate all possible inputs - so it's a good idea to check that they have the desired behaviour.You may be interested...
29 Apr 2011
Hi,I've used some time ago a logarithmically spaced vector on 32 bands with Math.E logarithm base.There was a need in specifying min/max values within the vector, the logarithm base (Math.E is a standard choice, and the number of points)private static void GenerateLogSpace(int min, int...
7 Jun 2011
Hi,stack overflow happens when your computer's stack gets too many function calls, thus strings over 150 chars generate such error. There are several workarounds that you can use in order to solve this problem:1) optimize your code to get fewer function calls2) use Stack object in order to...
19 Jul 2011
Convert an input value to an output value in a proportional range - requires tricky calculations.
22 Dec 2011
I have been doing many different stuff in image processing with C# and I know how to do edge detection , Gaussian Blur and many other things but now im stuck with this one...I have tried different ways to do it and ive gotten close but its not surface blur.Surface Blur: Blurs an image...
4 Jan 2012
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.Try it yourself, you may find it...
3 Mar 2012
3 Apr 2012
Seems like this one is the standard right now for algorithms: http://www.amazon.com/Introduction-Algorithms-Thomas-H-Cormen/dp/0262033844/ref=sr_1_1?s=books&ie=UTF8&qid=1333499461&sr=1-1[^]. There really is not much in C# on algorithms, probably because most colleges use Java and not C#, and...
1 May 2012
In the case of N=1 she is used in our life as a constitutional monarch. Please check with http://en.wikipedia.org/wiki/Constitutional_monarchy[^].Yes, in our world.For other uses, please see:http://en.wikipedia.org/wiki/The_Queen_%28disambiguation%29[^].&mdash;SA
11 Sep 2013
Now, one more, pretty obvious algorithm.Create N points in same range, for example, the square on the points (0,0) and (1, 1), where N is a random number >= 3. For the obtained set of points, build a convex hull. You can find some algorithm if you read this:...
25 Nov 2013
Please see my comments to the question, and the main one would be the first, about personal preference, which render the whole idea making little sense. However, it's not clear, maybe you already solved it. It can be solved by asking about personal preferences in some way. Every time I had to...
21 Feb 2014
Sudoku Generator
31 Jan 2015
For small numbers, you might calculate all permutations and weight each permutation with the largest share. The minimum of the largest share (not necessarily only one) is the best choice according to your criterions.E.g.ABCweight561 4 9 3 1 22056 14 9 3 1 21956 1 49 3 1 21556 1 4...
23 Jun 2015
Computational algorithms pertinent to finding the great-circle distance between 2 points on Earth
26 Apr 2016
Adding more methods (select points, draw triangles, etc) which allow us to do some specialized drawing on the HTML5 Canvas so we can investigate the Calc Convex Hull algorithm.
28 May 2016
This is HomeWork, but you have done some work.Advice:- In first I would have separated the code solving each exercises. It is just making reading the code easier and debugging too.exercise 3You already know the maximum length of sequence.you have basically 2 solutions.- you build...
26 Oct 2018
Generic algorithm to generate mathematical sequences
14 Dec 2018
Simple Linear Regression from scratch in Rust
28 Oct 2020
Linear-time partition: A divide & conquer based selection algorithm
22 Jan 2021
The Taylor series for sin(x) is simple: sin(x) = pow(x, 1) - pow(x, 3) / 3! + pow(x, 5) / 5! - ... But your implementation does two things: starts with -1 instead of 1, and makes it look a lot more complex than it needs to be. If you don't...
31 Mar 2021
Find type of distribution and parameters from set of distributed physical values
13 Apr 2010
Step 2 in the following article has the source you're after I thinkhttp://mitpress.mit.edu/e-journals/Videre/001/articles/Little-Boyd/gait/system.html[^]
13 Apr 2010
Well the algorithm is clearly described in this paper[^]. I haven't seen a code for parallel optical flow anywhere so I guess you might have to code it yourself.-Saurabh
15 Apr 2010
I'm not sure there is a formal algorithm for this (I could be wrong), but the simplest way is just to scan through: if the current element is not the same as either of the elements to either side, it is unique. Pretty simple, isn't it? Or am I missing something?Oh, and the word you want is...
28 Apr 2010
When performing division by a constant that is a multiple of 2 we can optimise the operation by performing a right shift.eg i = i >> 3;is equivalent to i = i / 8;My questions are:* Is there likely to be a tangible benefit to doing this or would a compiler (gcc in my case)...
4 Jun 2010
You could have tried this[^] first.
4 Jun 2010
I googled this [^]and got below any many more links!http://www.inkscape.org/[^]http://www.rotordesign.com/servolite/body_dxf_to_gcode.html[^]BTW, how is your question related to C#?
16 Jun 2010
total_day_wind looks like either a float or double to me. It's a bit trivial to sort a single value...If you've got a collection of wind speeds somewhere and you want to sort them into ascending order then use std::sort:std::vector wind_speeds;// Much clever code to...
7 Nov 2010
Hi,can somebody advice me a good book or website for neural networks? RegardsRobert
3 Dec 2010
Hi Pallab,using file based merge sort would be the way to go for you.Please read this blog entry:http://splinter.com.au/blog/?p=142This merge sort works by breaking one big file into smaller chunks.These are conventionally sorted and written to disk. Then in a finaloperation...
7 Dec 2010
In the book Modern C++ design[^] by Andrei Alenxandrescu, there's a chapter about small object allocation. He describes an efficient way of managing a lot of small objects in memory (allocating and deallocating them yourself in an efficient way). I don't know if this worth to buy the book just...
19 Dec 2010
Is that what you want?double result = bigzarb(x, w) *Math.Pow(10,m)+ (bigzarb(x,w)+bigzarb(w,y))*Math.Pow(10,m) +bigzarb(y,z);textBox1.Text = result.ToString()return result;
13 Jan 2011
http://www.cnc...
28 Jan 2011
I guess you are attempting to create some sort of resizable memory stream since your last line reads: Read, Write, Seek, ... members to manipulate the contentTry using the existing MemoryStream[^]. If that's not good enough - try reimplementing the MemoryStream using a list of buffers....
4 Feb 2011
If this isn't an assignment, and the algorithm isnt set in concrete, i would suggest taking a look at huffman coding[^].If it is a set algorithm for you to implement then we generally don't do your homework but here goes#include #include //comp()void...
15 Feb 2011
The computational efficiency of the Euclid's algorithm is much higher that the alternatives
21 Feb 2011
Hello guys,I decided to try and do a problem about analyzing the worst possible runtime of an algorithm.Since I'm a beginner and I want to do an understand this right I require some help.I came accros this problem in a book that uses the following algorithm:Input: A set of n points...
22 Feb 2011
You're doing C * n(n - 1) iterations (where C is some constant), yielding T(n)=C*n^2 - C*n.Remember that for the O notation we drop constant factors and lower order terms giving O(n)=n^2.Because you're dropping constant factors I don't think it makes any sense to represent the 1, 2, 3...
4 Mar 2011
Each piano key has unique frequency. So the frequency domain i.e fourier transformation helps to identify the pattern of the pure sound from noise. That pattern you could use compare the sound."Another thought I had was that a note should be more or less the same each time it is played. If...
4 Mar 2011
This problem is NP-hard. Hundred vertices is enough to make any implementation run almost forever (until it runs out of memory) because it needs to compute way too many things.| /*\ /*\ /*\ /*\ /*\ /*\ /*\ /*\ /*\ /*\ /*\ /*\ /*\|S---*---*---*---*---*---*---*---*---*---*---*---*---T| \*/...
24 Mar 2011
Yes, run a test: feed the two algorithms with the same input data (making sure the output is correct) and measure performance.
25 May 2011
Hello,I am supposed to take data from wikipeadia dump or freebase dump or dbpedia.I am then supposed write code that gives as output what every datum in that database is. eg: name of a person or a bussines, address,... It does not matter in what language i write the code but, I’m only...
20 Jul 2011
Hi all,I'm currently debugging a ship monitoring system. In that application I found whole heaps of bugs, fortunately I can solve every single one of them, except this one. So please help me.Here's the explanation:The bug is located within a distribution server, and I suspect (No, I'm...
3 Aug 2011
According to the paper where you ripped that phrase from, it's an area of research aimed at various targets:1. Identifying commercials.2. Video copyright.3. Video clustering.If you want to find out more about it, I would suggest that you read the PDF available here[^].
19 Jan 2012
A very simple google lead straight to Wiki: http://en.wikipedia.org/wiki/Analysis_of_algorithms[^] which contains all of the info you need.In future, please try to do at least basic research yourself, and not waste our time and yours.
4 Mar 2012
Here[^] you will find library for matrix calculations.Good luck.
26 Mar 2012
A Shunting yard algorithm in C#
23 Apr 2012
For an efficient solution, you can work as follows:- declare an array of strings that is indexed by all possible character values (128 entries will do for ASCII characters); let it be Confusions;- every entry in the array gives the list of possible confusions; the string representation...
24 May 2012
I guess you are looking for bool next_permutation[^]Call it i times and you'll have the i-th permutation. (or the i-1 combination)Best regardsEspen Harlinn
11 Nov 2012
Assuming that your note array in ordered largest first, I would simply divide the value by each note value in turn: the quotent is the number of those notes to issue, the remainder gets passed down to the next note denomination.So if your value is 123 and your notes are 10, 5, and 1:123 /...
15 Nov 2012
Please have a look into the following links 1. Calculate Golden ratio[^] 2.Golden ratio calculator[^]
29 Nov 2012
The most common attributes of logarithmic running-time function are that:the choice of the next element on which to perform some action is one of several possibilities, and only one will need to be chosen or the elements on which the action is performed are digits of nThis is why, for...
29 Nov 2012
The Big-Oh notation has a well-defined mathematical meaning. When you say that a function f of a variable N is big-Oh of some function g of N, it means that f(N) is bounded above by C.g(N) for all N [except maybe for the first values], where the coefficient C is called the "hidden constant"....
24 Feb 2013
Please try first what you want to do, and if you have a specific problem, ask a question. You don't provide what you've tried, you don't provide some source code, you don't provide the programming language you're using ...Also, don't fill your question with meaningless commas.If you...
26 Jun 2013
Google is your friend: Be nice and visit him often. He can answer questions a lot more quickly than posting them here...A very quick search gave 4 1/2 million results:...
28 Jul 2013
I know there is a method for calculating the square root manually, but that one ins not particularly useful for calculating it on a computer. Computers can multiply and divide numbers with many digits and the execution time is nearly the same, no matter the factor are a single digit or contain...
17 Sep 2013
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.If it's an interview question,...
26 Sep 2013
That's a very odd way to do it. I wouldn't concern yourself with list size at all.I'd recommend a two stage approach, first identifying the node you want to remove, the removing it. A good way to keep things consistent is to have an empty dummy node at the beginning of the list, purely to...
25 Nov 2013
To add to what Sergey said (in that finding the seats is O(N), but really doesn't say what ones are the "best".You could assign weights to each seat, with "better" seats having higher values. While searching for seats you hold the currently selected seats as the highest value (sum of y...
2 Dec 2013
Closest latitude and longitude to a referenced latitude and longitude.
26 Jan 2014
Similar questions with answersC# Facial Expression Recognition[^]Facial Expression Recognition[^]facial expression recognition[^]Search Codeproject & Google for more
25 Mar 2014
As Richard MacCutchan said, you will need to design a Database first to capture the information about each meal each user has had.Here's a link to a beginners guide to databases[^]Think carefully about the tables you will need and what sort of information you will need to...
24 May 2014
You can use one of the classes in the System.IO.Compression Namespace[^].
12 Dec 2014
Here's a solution that just counts the characters and keeps track of the longest sequence seen so far. class Program { static string input = "aaaabbcddddddddddeeffffg"; // expected: "d" static void Main(string[] args) { var longest = FindLongestRepeat(input); ...
19 Dec 2014
read all the articles and books you canpick a 'pet' project or two and practice applying and redefining the implementation of algorithmsthere is NO magic potion you can take - it all takes time, knowledge & practice
19 Dec 2014
First of all, it's helpful to agree on the term Algorithm[^]: [...] In mathematics and computer science, an algorithm [...] is a step-by-step procedure for calculations. [...]There are various angles to look at your question.If it's about your skills to implement an existing step-by-step...
11 Jan 2015
I can't see the difference... O(n) means that (in worst case) you have to visit every node to get the answer.It does not changes if you check it from the beginning to the end or from both end to the middle...As to check one item is a constant time and you ave to check all items (in worst...
30 Jan 2015
You can't implement merge sort "in place". If you swap or overwrite some of the elements, it isn't a merge sort anymore. In this case, moving an element from one sequence to other potentially breaks the other sequence (eg. it is no longer ordered).static std::vector merge(const...
9 Mar 2015
This the wrong forum for conducting research.I suggest that you will get a better response from google[^]
11 Apr 2015
Do your own.Looking at code doesn't tell you why decisions were made, what alternatives were considered, or why they were rejected."Doing" is a better way of learning - it encourages the growth of skills instead of just blindly repeating existing code and hoping it's the best way to do it.
12 Apr 2015
Understanding the mechanism of GA is already hard, not to mention trying to interpret other people's code that implements it. That is even harder if you never code before. Come back to the GA, you can create a model like this:1. Represent each potential solution by a 40 gene-chromosome,...
23 Aug 2015
It doesn't look that difficult: The requirements already define the algorithm (that uses independent allocation strategies).At each input, based on the number of passengers, you just have to find the first fit, considering only available seats. What is your doubt about?
14 Sep 2015
We can't answer that: it's down to you.If you have "very little interest in algos" then only you can do anything to encourage you to start learning. You can't force someone to learn something unless they are prepared to invest time, effort, and interest in the subject matter; no book,...
29 Sep 2015
Here's an SQL Server Recursive Common Table Expression to do it:WITH cte AS( SELECT -1 [Day] , 1 [Aliens] , 0 [+1] , 0 [+2] , 0 [+3] , 0 [+4] , 0 [+5] , 0 [Eggs]UNION ALL SELECT [Day] + 1 , [Aliens] + [+1] , [+2] , [+3] , [+4] , [+5] , ( [Aliens] + [+1] ) * 3 , [+2] + [+3] + [+4]...
12 Oct 2015
You have already been given some advice on how to start to learn to program.You don't "learn algorithm" - you use algorithms to solve problems - there are many, many algorithms to address many, many different problems. An explanation was provided against your earlier post what is the...
12 Oct 2015
It sounds like a usual chicken or the egg problem.You always learn everything in parallel and iterations. Say, you take a book on language and read it from the beginning to the end. If you are a beginner, you won't really understand and appreciate everything, even if you do those programming...
17 Oct 2015
Tips for creating mathematical cross-platform applications in JavaScript and display formulas and other content with MathJax and JQuery Mobile.
22 Dec 2015
"How do I prepare for such interview questions? Are there any websites or resources that will help me"I'm sorry to tell you this, but if you have to ask, then the answer is "no".If you want to pass an interview that involves questions like this, then the only way is to know your stuff -...
14 Jan 2016
The answer is: yes, because the "naive method" will give your O(N) time complexity anyway. In fact, all non-nonsense algorithm will give you O(N). It's easy to understand why: 1) given known index in the array, the time complexity of taking the element is always O(1) (that is, a constant), due...
20 May 2016
Regular expressions are not the best tool for this, because you will have nested parts of your input text.In this case it with be more robust to use a parser, but that has a bit of a learning threshold. ANTLR4 is a free parser originally for Java, but it has a version for C# as well. See...
6 Jun 2016
7 Jun 2016
Quote:Users should be able to add new friends (as many as they want!) and store the number of days ago that they last talked to each friend. Let users update this value (but don't let them put in bogus numbers like negative values). If the data is to be stored in a database, it is a bad idea to...
3 Aug 2016
F#-implementation of algorithm for incremental construction of minimal deterministic finite automata through adding and removing strings.
11 Jul 2016
Because the developer doesn't know that he should start at 3, step by 2, and stop at sqrt(num) ; typical rookie mistake.
30 Oct 2016
Found it!After hours of trying I decided to leave the problem alone for a while and now, after a few weeks, I fixed it in like 5 minutes.The while loops should look like this:while (items[map[low]].value
27 Dec 2017
26 Jul 2018
Let the loop run downwards. Then the exponent value can be assigned to the loop variable initially. Because you have to initialise the result too and will use exponent, this must be done after initialising the loop variable. Fortunately, C/C++ for loops allow multiple statements in the init...
15 Sep 2018
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action. Try it yourself, you may find it is...
1 Oct 2018
I tried your formula in my little test bed which uses VS17 and I got exactly the same results you did. I tried various values for the iteration count from 32 to 128 and all gave the same result. FWIW, above about 127 gives an NAN. I think you are running into the numerical limits of 64-bit...
3 Oct 2018
Writing a good mathematical library is very difficult. The library must not only give accurate results, but must also preserve other attributes, such as monotonicity (i.e. if the mathematical function is monotonic, your approximation should also be monotonic), odd/even behaviour (i.e. f(x) ==...
26 Nov 2019
Provided the loops are not nested, your final result is correct, in my opinion. Since for i = 1 to k do // k * const c[i] = 0 for j = 1 to n do // n * const c[A[j]] = c[A[j]] + 1 for i = 2 to k do // (k-1) * const c[i] = c[i] + c[i-1] for j = n-1 down to 1 // (n-1) * const B[...
24 Sep 2020
The argument of isdigit is supposed to be a character, but you are passing it a int variable. Assuming your code should really deal with numbers (that is integers) and not digits, you might re-write your program this way (note you don't need an...
14 Feb 2021
Quote: im too stupid and i didnt try anything can anyone help me to solve this quetion No, because you don't want help, you want us to do the job and give you a working solution so you can claim it is yours. It is rude of you. For this kind of...
18 Sep 2020
If you don't understand the question - and it's pretty clear - you need to talk to your tutor and get them to explain it to you in terms you can understand. Until you understand the question, you have no hope whatsoever of understanding - or...
21 May 2021
I used some code from : GitHub - drasis/cpp_maze_generation: generating mazes in different shapes[^] to make mine. Sorry, I can't show you a shot right now. I found a link there to a great reference page on mazes : Think Labyrinth: Maze...
28 Jun 2021
A new method for 2D polyline simplification and also smoothing that alternative to Douglas-Peucker and curvature-based simplification algorithms
16 Apr 2010
Use the inbuilt methods of the List(of ) class to find the min or max values, e.g. Dim ints() As Integer = {11, 3, 5, 2, 8, 9} Dim intList As New List(Of Integer)(ints) MsgBox(intList.Min)
21 Apr 2010
Ok, and what is your problem about? :)JanTCode wrote:I want to know the executing times of the sentence labled by '@' when n is givedI think you've at least two options:Count.Develop a program for counting on your behalf.
23 Apr 2010
Hi all,I've landed in a situation where i need the top N number of items in an array, work on those items and reinsert (or update) them back at the exact same indices. I realized that the easiest way would be to sort an array 1st then pick N number of the highest elements, but I find my...
22 Apr 2010
With the pitiful amount of info you've provided, the best I can suggest is that you look into using a Dictionary object instead of an Array.
28 Apr 2010
When you write bitwise shift operation equivalent microoperation takes only one micro-operation to be performed by the ALU(CPU). It takes binary representation of the value supplied and performs a single "shift" micro operation.But when you write a division(float) it is converted into either...
1 May 2010
If you understand properly the theory then it shouldn't be too difficult. Make sure you understand how recursion works and then start with a very simple grammar. :)
26 May 2010
It is easier to help if you give a description of in what way your code doesn't work, rather than just stating that it doesn't work.However, I am guessing that your program appears to run for ever? I would suggest that you investigate what happens when a[right],a[left] and piwot are all the...
2 Jun 2010
Hi,I need to parse a CSV file[^].My file data is in below format,NRTIT15;15/05/2005;NRTIT16;16/06/2005;OZ9520;03/09/2004;I need to check the blank lines in the file at EOF.If my file contains line feed at the end, i want to print the error mesasge.For each line i am using \n....
7 Jun 2010
Ron Rivest was co-author of a book on Algorithms in the early 90s that described MD4. It should be available from any good technical library.It's called: "Introduction to Algorithms, Third Edition" by Cormen, Leiserson, Rivest and Stein.Failing that look in RFC 1320, it's got all the...
11 Jun 2010
Depending on what your Polygon is (Image, Array of Point etc....) you might be able to use a Matrix Translation. If so Matrix Transformation of Images in C#, using .NET GDI+[^] might be of some use.
31 Aug 2010
Do you asking about some math to calculate angle between 2 vectors to check the arc? You mentioned about 3 points and i asume there is something like this:[how do i see this]then you need to calculate angle or check dot product between 2 vectors and according to result you will be able...
18 Dec 2010
You have your logic wrong in the final two while loops.try:while (x
5 Jan 2011
Just follow the wiki entry to the algorithm for solving it:[^]
1 Feb 2011
Suppose random points P1 to P20 scattered in a plane. Then is there any way to sort those points in clock-wise.See image Here.Here we can’t use degree because you can see from the image many points can have same degree. E.g, here P4,P5 and P13 acquire the same degree.
1 Feb 2011
The best suggestion I can give is to have a look at Wolfram Alpha Mathworld: http://mathworld.wolfram.com/LHospitalsRule.html[^] - start here and see what you can find.If nothing else, it may explain it better than we could because it has all those funny little symbols we only used for APL...
16 Feb 2011
HiInterpol...
16 Feb 2011
Hope Interpolation Methods[^] will give you an idea.
22 Feb 2011
To begin with, you should take a look how many steps the algorithm has to take to end.For n = 2 this would be 1, as it terminates on line 1.For n > 2 the number of steps is determined by the two nested loops and be equal to the number of times the outer loop is executed times the number...
27 Feb 2011
There is an article here on CP: A C++ Implementation of the Blowfish Encryption/Decryption method[^].Hope that helps you!
16 Apr 2011
11 Mar 2011
If your desired result is a final list of unique items, you could try adding the items from each Dictionary to a HashSet, and go from there. I don't know if this is going to be any faster, but it's worth a shot.You might be able to do this in .Net 2.0 - extension methods (typed off the top...
18 Mar 2011
I think this totally explains how to solve this simple problem: http://www.euclideanspace.com/maths/algebra/matrix/orthogonal/rotation/index.htm[^].&mdash;SA
29 Apr 2011
My attempt (not tested):import java.util.ArrayList; //Create logarithmically spaced vectorpublic static ArrayList logarithmicSpace(int start, int end, int count){ ArrayList ArrList= new ArrayList(); for(int i = 0; i
1 May 2011
Without extra library?! Well, AForce.NET is using .NET only, so, here is the plan:Try to solve the problem all by yourself;When you get enough experience and still face problems, build AForge.NET library and try to understand how it works; may be it will help you;Go back to item 1;...
14 Jul 2011
shiny1366 wrote:which algorithm will be best for finding shortest path between 2 cities?Dijkstra or Floyd-WarshallTGoogle[^].
19 Jul 2011
If I am not too wrong, I think that the rows in your sample file can be described by the following grammar:(word) /m/ word (word) number . number (word) [/m/ word]Where word stands for a non-empty sequence of lettersnumber a non-empty sequence of digits(item) a sequence of item...
27 Jul 2011
Because of the specific terminology in use, I cannot understand the details. More specifically, I have no idea what a Downline is nor what AllLegs can mean.Anyway, it seems to me that this problem can be formulated as a set of linear inequations of the form 0
31 Jul 2011
I hope you are able to slightly modify the code of permutation algorithm provided here to get the results needed.
13 Aug 2011
Wow. This forum is for programmers. People who write software for computers. It sounds like you barely know how to use one. What does it mean ? It's the name of a program, I assume. I suggest you find a forum that operates at your level ( if such a forum exists ) and ask your questions...
31 Aug 2011
Convert the tree to a list using an in-order traversal[^]. The list will be sorted, except for the two swapped elements. The first of them will be followed by a smaller number; the second one will be preceded by a larger number.9 10 16
14 Sep 2011
Your dist() function is expecting an array of 3 doubles. Assuming your input variables are declared like so: double brick_v[3]; double metal_v[3];You should call dist() like so: dist(brick_v,metal_v);Note that the return value of dist() is a double (one number) and not...
14 Sep 2011
dist takes two double arrays of length 3, you're passing two doubles, assuming brick_v is an array of double then brick_v[3] is a double
29 Nov 2011
I gave you some links two weeks ago, and here[^] is another you could have found easily, what have you been doing since then to research this question?
29 Nov 2011
19 Jan 2012
You really want to read this Wikipedia article: Computational complexity theory[^].The meaning of input size depends on the concrete algorithm that is being analysed.For the definition of "bestcase,worsecase,averagecase" please see the referenced article.Short example:Appending a...
6 Feb 2012
21 Mar 2012
I don't think the whole notion of such algorithm is applicable to the flash devices at all."Removable flash memory cards and USB flash drives have built-in controllers to perform wear leveling and error correction so use of a specific flash file system does not add any benefit.", according...
26 Mar 2012
Hi,As Big O notation, its shows worst case possibility.What Theta Notation like, Theta Notation,Little-O Notation ,Little Omega Notation means.If possible please give question in simple English rather that Mathematics.Thanks
26 Mar 2012
You can't really define these notations in "simple English" - they are complicated mathematical concepts which need precise definitions to show the significant differences.Google: Look at Wiki, and a Wolfram Alpha - they both explain them, but not in simple English!
12 Feb 2014
This is an alternative for "Send Mail With Attachment File"
21 Apr 2012
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.Try it yourself, you may find it...
23 Apr 2012
Hello the thing you are trying to write really looks like a DFS(Depth-first search)Depth-first searchbut to complete it you need to use Recursion meaning that the function Route has to call herself. You almost did it :) The problem here is that the algorithm itself isn't what you needDFS...
24 Apr 2012
You are lucky I'm bored. :)We'll start with the set up; first of all you'll need the player and nodes. You can't have a simple reference to another player as the noe also has an attribute - length.I have missed a lot of code here, but make sure that the two players on either side of the...
2 May 2012
The question is not really correct. First, the criterion "most secure" can not be strictly defined. Moreover, suppose you have some secure algorithm, without a flaw like a backdoor, which can use different hash sizes, a hash sizes being a parameter. You can always make it more "secure" by...
17 May 2012
The quality of the proposed words highly depends on the algorithm you choose. One very straightforward is SOUNDEX[^]. Not sure if that's suitable to your needs, but have a look
17 May 2012
If you're looking for database algorithm to "catch" bad inputs, see SIMIL[^] slgorithm.
13 Aug 2012
I only read the first solution you linked to, but I'm guessing the other one uses the same mathematicians' shorthand. If you read it carefully, they take the left partition to recurse on, and imply that the same process is done on the right. (In fact, reading it again, they actually state that...
18 Sep 2012
IP checksum implementation in python
17 Sep 2012
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.Try it yourself, you may find it...
29 Oct 2012
You could try some google search with Lexicology[^] and Semantic[^]and then from a computer science point of view you might want to look at :Inference engines[^]Can have a look at lemmas and morphosyntax as well...I used to be part of a project almost 20 years ago which aim to make...
1 Nov 2012
1) Research each item in your list by using the developer's best friend, google.2) Compare the data that you acquire in step 1.3) When your question is more specific, ask that here and we will be more then happy to help you out.Cheers.
3 Nov 2012
7 Nov 2012
The algorithm described herein is designed to implement sorting of variable length strings in O(n) time.
12 Nov 2012
For real life currencies and notes: their values are designed in such a way that you can get the value of the next higher note using lower value notes so Solution 1 is the best one in this case. It is not always the case however for any combination of note values. Consider the case where you...
23 Nov 2012
This article Generation of n Digits of the Golden Ratio (Phi)[^] should help.
14 Dec 2012
Your problem statement is very messy and difficult to follow.My understanding and formalization are as follows:Assume you are in state [x, y, z]. Here are the possible transitions:Fill 12 -> [12, y, z]Fill 8 -> [x, 8, z]Fill 3 -> [x, y, 3]Empty 12 -> [0, y, z]Empty 8 -> [x,...
26 Dec 2012
routing with genetic algorithm C# or VB samplehelp me
27 Dec 2012
The question doesn't make sense.What algorithm??Are you asking how to decrypt the data? Without knowning how it was encrypted you're not going to be able to decrypt it.Are you asking what the meaning of the data is? Without the documentation on it, it's just a bunch of giberrish.
1 Feb 2013
See Robert Sedgewick[^]'s book list: Part 5: Graph Algorithms is the book to read (you choose: C, C++, Java). It would be a nice exercise if you write all the code of the book in C#. ;-)CheersAndi
18 Feb 2013
If you want the best solution, you need to evaluate all permutations.Often, a good enough solution is sufficient.If you can define a "good enough" criterion, you can define a break condition to stop searching.E.g. (pseudo code):iteration = MaxIterations;best = none;while...
28 Feb 2013
Hi all,I am trying to write a program that simulates scanning pages one side then the other to simulate a duplex scan and then reorder the pages into their logical sequence. For exampleif I scan a bunch pages in the order 1,3,5 then the other side 6,4,2. The second scan you flip the...
29 Apr 2013
Quote:I now have a good idea about it but I want to test an example from the link.At the top of the article, there are some download links to download source, demo ...Quote:How can I do that and what I should have in order to run the example code? Ask this question to the author. At the...
19 Jun 2013
How large?If it's a couple of megabytes, then try just using Split and Sort: Stopwatch sw = new Stopwatch(); sw.Start(); string s = File.ReadAllText(@"D:\Temp\MyText.txt"); string[] data = s.Split(' ', '\n'); Array.Sort(data); ...
22 Jun 2013
Hi,I am trying to write an algorithm to find a path (not necessarily the shortest one) between a given start and end point.An user will enter the start location, the end location and the available time to travel. For each eadge of my graph I know the cost in time to traverse that edge...
26 Sep 2013
Thanks to CPallini, who gave me a good hint, I came up with this function if anyone is interested. (This is first, rough code, but it produced exactly what I was looking for):void scaleXLn(std::vector& data, std::vector& result){ size_t oldSize = data.size(); size_t...
22 Nov 2013
Start here : hOOt - full text search engine[^]
25 Nov 2013
Hi I'll try to keep this short,So I'm working on a Cinema booking system and it is time for me to think of an algorithm to decide the "best" place(s) in the Cinema. I've been thinking of maybe using a BFS but jumped to the conclusion that this may not work as each hall may vary in size, on...
25 Nov 2013
I'd suggest you start with this CodeProject article "Fast Optimizing Rectangle Packing Algorithm for Building CSS Sprites" by Matt Perdeck: [^]. The article contains a good overview of the packing problem, and goes on to develop, and improve, an algorithm.The "Nuclex" rectangle packing...
11 Dec 2013
Perhaps, before you try to get us to do your homework for you you might want to sit down and think about how it makes you look when your "question" to us consists of "here is my homework question - go look at it and give me an idea".For my perspective, it looks like someone too lazy to even...
27 Feb 2014
Basically it's:1. Permute your pixels by first rotating each row and column by some steps2. Encrypt each pixel using XOR (probably this step is meant to obfuscate the permutation from step 1)3. Repeat a couple of timesThe algorithm uses a "seed" of (number of columns + number of rows...
20 Mar 2014
I think you need the number of integer between the first integer after sqrt(first) and before sqrt(last).To get the first integer after, you can use Math.Ceiling.To get the first integer before, you can use Math.Floor.Then the complete formula should be :Math.Floor(Math.Sqrt(last))...
31 Mar 2014
Well, several searchs doens't come up with one, so I guess the answer is "No".
12 Apr 2014
Have a look through this list of links https://www.google.co.uk/?gfe_rd=cr&ei=kmlJU9emGafY8gf48YHIDw#q=simulated%20annealing%20algorithm%20formula[^]I would suggest staying on the first page of links or using more information to improve the filter ... 1.17million hits is a bit too much to go...
10 May 2014
There is no sorting on hard disk, what ever sorting of files you see on the screen is the work of some software such as the OS. Refer:1. About hard-disk[^]2. how-data-is-stored-in-your-hard-disk[^]
4 Jun 2014
It looks like a school assignment, and the problem is not clearly and fully defined, so, sorry: no complete solution for you.The question simply makes no full sense. List is irrelevant. If you select some subset of n
22 Jul 2014
It may help to first look at the easiest non-trivial case, i. e. n==2. The function you are looking at maps 2-space to a real number, and if you combine the result y with the argument vector (x[0], x[1]), you get a point in 3-space, (x[0], x[1], y). What you have, now, is a surface. For n>2...
12 Aug 2014
You should first learn the basics of the C++programming language (for instance, you cannot ignore '*' and '->' operator meaning) and then try to understand the algorithm.