# Questions tagged [complexity]

Complexity is the analysis of how the time and space requirements of an algorithm vary according to the size of the input. Use this tag for reviews where the "Big O" is a concern.

343 questions
Filter by
Sorted by
Tagged with
47 views

### Get contiguous subset from given N numbers using less numbers of loop [closed]

Here is code : ...
82 views

### Searching an element in a 2D sorted array

I had to write a code (as an exercise) that receives a 2D row wise and col wise sorted array and an element, and return true is the element exists in the array. The first thing that came to mind when ...
20 views

### Intersection of Two Arrays - Space Time And Complexity [closed]

The problem is as follows: Given two arrays, write a function to compute their intersection. The below code is my solution.I'm just curious as to what the space time and complexity of below algorithm ...
80 views

### Permutation 1…N. Answer queries “How many numbers between [X,Y] position are in the interval [L,K]”?

So I am solving this task: We have an permutation of the numbers 1..n. I need to answer m queries: -How many numbers between X-th and Y-th position are in the interval [L,K] (<=k and >= L)? So my ...
60 views

Code Problem ...
16 views

### Simplifying code for deleting directories

Background info: An FSObject is a dir or a file. The structure definition for a directory (dir) is the following (define-struct dir (name owner contents)). A ...
57 views

### Choosing between 2 Fibonacci alternatives [closed]

Task: Return the fibonacci value at a given index. e.g: input: 6, return: 8. Algorithm 1: ...
56 views

### Algorithm to find the Array Balance Point

Task: Find the balance point of an array; return the index that if you break the array into left and right at that point will ...
40 views

319 views

### Finding the upper and lower bound using binary search

I am trying to solve this InterviewBit question https://www.interviewbit.com/problems/search-for-a-range/. My code for this seems to be working properly and it does give me the correct answers on my ...
106 views

### Time(n) Complexity of Fibonacci Algorithms

It is my first use of classes in Python. I wanted to create something useful and try some new things as I learn this cool language: strategy pattern, testing with nanoseconds precision, curve/poly ...
171 views

### Program that prints star pattern

I have a program that prints the star pattern. Starr Pattern is: ...
137 views

### Phonebook using a trie

I implemented a PhoneBook utilizing a Trie data structure. Could I ask you to evaluate it? Did I apply Trie correctly for such ...
573 views

### The quicksort algorithm in Haskell

I am learning Haskell programming language mainly from this source. And there I have encouraged with "an elegant" realization of the quicksort sorting algorithm (the Quick, sort! section). Here it is: ...
210 views

### Extending the extended Stable Marriage Problem using a Python class

As soon as I saw this open source paper, I thought that the best way to replicate their code would be using a python class. After having replicated and extended the ...
156 views

### Reverse String in Java

I've been revamping on my coding puzzles practices. What is the complexity (both time and space) for this method? ...