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
Can someone suggest how to solve the below search problem easily, I mean is there any algorithm, or full text search will be suffice for this? There is below cl
How to mathematically solve the recurrence relations of the following form : T(n)=(2^n)T(n/2) + n^n T(n)=4T(n/2) + n^(2)/logn Is there a generic method to solve
How to mathematically solve the recurrence relations of the following form : T(n)=(2^n)T(n/2) + n^n T(n)=4T(n/2) + n^(2)/logn Is there a generic method to solve
I have an image that consists of small black dots, and in each dot's vicinity there is some noise that appears as grayish smudge. I'm trying to use some sort of