### Analyzing time complexity of m operations in Union-Find structure

The task is to find the time complexity in the worst case of m operations in Union-Find structure...

### Best javascript data structure for an ordered object that i can insert into and iterate [on hold]

I want a object of let's say grocery items. each grocery item has an ID and a price. I want to be...

### How std::advance iterator type is deduced?

Please take a look at the std::advance function. According to cppreference the complexity is: ...

### What's the time complexity for downcasting an object?

I received a generic Object type instance from a RPC service that I want to cast to a MyClass type...

### Codility: MaxZeroProduct - complexity issues

My solution scored 100% correctness, but 0% Performance. I just can't figure out how to minimize...

### Why does the insertion-sort algorithm has a quadratic instead of a quasi-linear time complexity?

Can someone explain how the insertion sort has quadratic time complexity and not quasilinear time...

### What is the time complexity to sort 3 elements? (no constraints given)

This was asked in the interview. they have not given any constraints. If we consider a for loop, it...

### Why is splitting a Rust's std::collections::LinkedList O(n)?

The .split_off method on std::collections::LinkedList is described as having a O(n) time...

### Worst Case minimum Sorting Time Complexity Theorem

I am studying sorting algorithms and I am stuck on the theorem that proves that a sorting algorithm...

### Time complexity reduction [on hold]

I need to reduce time complexity of this code. For one file it takes 17 minutes and when i...

### Time complexity bounded by omega

Hi I was wandering if this statement is true. if f(n) = omega(g(n)) and g(n) = omega(f(n)) does...

### How to write the code with less time complexity for finding the missing element in given array range?

My function should return the missing element in a given array range. So i first sorted the array...

### Finding the 7th smallest element in Min heap

In a min-heap with n elements with the smallest element at the root, the 7th smallest element can...

### Understanding this Time Complexity issue (Cracking the coding interview)

Question: String joinWords(String[] words) { String sentence = ""; for (String w : words)...

### Performance of algorithms that loop more/less but with same number of O(1) operations

Whenever I see algorithm optimization, I see lots of talk about reducing loop count. Often times, I...

### Time complexity to delete a leaf node from Max Heap?

Let's say we're given with a MAX Heap and we want to delete any of the leaf node, then how much...

### Solving recurrence relations where they cannot be easily put in MT form

I have the following recurrence relation: T(n) = T(n/2) + T(n/2) + n In this instance, I...

### How to write js code with minimal number of jumps required to reach target with less time complexity

I wrote like below. But how to make it more efficient. Need suggestions!! For example, given: ...

### Swift's Set complexity of equability test

What is in Big-O notation complexity of == operation applied on two Set<T> instances? I...

### What is the difference between american sort and radix sort?

I came across this sorting algorithm called american sort. I read it being a variant of radix sort....

### Why does this piece of code with two for-loops not have Big O runtime of O(N^2)?

I am learning Big O notation in my algorithms class. I just done an online quiz for this week where...

### How to read two big text files in one Hash Map [closed]

I have two text file like file1. txt file2.txt http://example.com ...

### time complexity for loop justification

Hi could anyone explain why the first one is True and second one is False?

### Is there a Java heap implementation that can remove arbitrary objects in O(logn) time?

Suppose I have a set of objects in a PriorityQueue, so that I can conveniently determine and remove...

### Why does numpy.median scale so well?

A question I recently got at a job interview, was: Write a data structure that supports two...

### Why is the algorithm complexity O(N*log(N+M))? [closed]

Consider the following code (Github link) The variable min is is at most M and the variable max is...

### Trying to understand the space complexity of concatenated string output

I had this problem in a coding interview: # AAABB should return A3B2 This is a classic algorithm...

### What is the time complexity if it needs to revisit visited nodes in BFS?

I am working on an algorithm problem. For Simplification, the problem could be reduced to: Given...

### finding length of linked list in constant time python

I'm trying to write a function which finds the length of a linked list in O(1). I know how to...

### Find the most optimal solution for sorting data organized in arrays and in AVL trees

This is a following practice problem I have for my exams in data structures. We want to get the...