I want to find the cycles with impar amount of nodes is in graphs. To do that I made the following algorithm which does a dfs walk through the graph and when it
This is something I do not quite understand. When I read literature on heaps, it always says that the big advantage of a heap is that you have the top (max if m
I am trying to make an agent predict the velocity required to throw a ball at a target and take into consideration the target. So what I need is a ball followin
I have a list of list, in different length, and my algorithm runs on every element in the sub lists. What should be my time complexity? I don't know if it's oka
One of my friends asked me about a coding challenge that their lecturer gave them as an exercise. I got a solution working to solve it. But I think the solution
I have created a linkedlist in Python using below classes: class: Node class Node: def __init__(self, data): self.data = data self.next = No
I have input keys that can cheaply be converted to a uint64_t (ie, the input contains less than or equal to 64 bits). Each unique key (not yet in the map) will
I will try my best summarising and explain as best as i can here. This is about tree traversal algorithms. A) Class Position template <typename E> // base
The problem I am talking about is the one below : Consider a rat placed at (0, 0) in a square matrix m[ ][ ] of order n and has to reach the destination at (n-1
I am trying to understand std::find(). Below is my code. std::set::find searches the container for an element equivalent to val and returns an iterator to it i
I am using PHP to build a simple plugin system in my own MVC framework. Here is the algorithm I am using to load the plugins: Scan the plugins directory. Use th
for this TIC TAC TOE game, I'm new to coding so I'm not sure how can change the A.I to play more intelligently, I know it's with the use of a minimax algorithm
I found this great answer by Gary C, which uses bitwise operators and minimal number of comparisons to check for a win in Tic-tac-toe. The only issue is that th
for (int index = 1; index < n; index *= 2) { int counter = 0; while (counter < n) { counter++; } } Determine its best and worst case r
I need some help to understand a precondition with respect to the Candidate Elimination algorithm. If I order the list of training data that the negative entrie
I had a painful experience today that I accidentally passed a list to a function, and took me ages to debug. The function was meant to take in a list and create
I am looking for an algorithm for the following (which may not be entirely well-formed, it's not yet clear in my head): Let n1 and n2 be two double-precision f
I have a json array in the following format [{"key1":"abc", "key2": "def", "key3": "ghi"}, {"key1":"abc", "key2": "jkl", "key3": "mno"}, ...]. There's also a ta
Most common sort algorithms define complexity in terms of the number of comparisons, where each comparison is assumed to be independently capable of acting upon
For a given array of integers, perform operations on the array. Return the resulting array after all operations have been applied in the order given. Each opera