The task is to find the time complexity in the worst case of m operations in Union-Find structure...
I want a object of let's say grocery items. each grocery item has an ID and a price. I want to be...
Please take a look at the std::advance function. According to cppreference the complexity is: ...
I received a generic Object type instance from a RPC service that I want to cast to a MyClass type...
My solution scored 100% correctness, but 0% Performance. I just can't figure out how to minimize...
Can someone explain how the insertion sort has quadratic time complexity and not quasilinear time...
This was asked in the interview. they have not given any constraints. If we consider a for loop, it...
The .split_off method on std::collections::LinkedList is described as having a O(n) time...
I am studying sorting algorithms and I am stuck on the theorem that proves that a sorting algorithm...
I need to reduce time complexity of this code. For one file it takes 17 minutes and when i...
Hi I was wandering if this statement is true. if f(n) = omega(g(n)) and g(n) = omega(f(n)) does...
My function should return the missing element in a given array range. So i first sorted the array...
In a min-heap with n elements with the smallest element at the root, the 7th smallest element can...
Question: String joinWords(String[] words) { String sentence = ""; for (String w : words)...
Whenever I see algorithm optimization, I see lots of talk about reducing loop count. Often times, I...
Let's say we're given with a MAX Heap and we want to delete any of the leaf node, then how much...
I have the following recurrence relation: T(n) = T(n/2) + T(n/2) + n In this instance, I...
I wrote like below. But how to make it more efficient. Need suggestions!! For example, given: ...
What is in Big-O notation complexity of == operation applied on two Set<T> instances? I...
I came across this sorting algorithm called american sort. I read it being a variant of radix sort....
I am learning Big O notation in my algorithms class. I just done an online quiz for this week where...
I have two text file like file1. txt file2.txt http://example.com ...
Hi could anyone explain why the first one is True and second one is False?
Suppose I have a set of objects in a PriorityQueue, so that I can conveniently determine and remove...
A question I recently got at a job interview, was: Write a data structure that supports two...
Consider the following code (Github link) The variable min is is at most M and the variable max is...
I had this problem in a coding interview: # AAABB should return A3B2 This is a classic algorithm...
I am working on an algorithm problem. For Simplification, the problem could be reduced to: Given...
I'm trying to write a function which finds the length of a linked list in O(1). I know how to...
This is a following practice problem I have for my exams in data structures. We want to get the...