Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all 39796 articles
Browse latest View live

ZCO problems

$
0
0

Hello, for the ZCO 2014 afternoon problem "SMARTPHONE", I'm submitting the following code in JAVA but there is a compilation error being shown, could someone please help me by putting up a correct code on how to correctly compile these programs.

ERROR:" Standard error /tmp/ccjoSEQH.o: In function main': cc24c7s8.i:(.text.startup+0xf): undefined reference toSMARTPHONE::class$' collect2: error: ld returned 1 exit status "

CODE:

`import java.io.*;

import java.util.Arrays;

class Mobile

{

public static void main(String[] args)throws IOException

{

    BufferedReader br= new BufferedReader(new InputStreamReader(System.in));

    int t = Integer.parseInt(br.readLine());

    long a[] = new long[t];

    for (int i = 0; i <t; i++)

    {

        a[i] = Long.parseLong(br.readLine());

    }

    Arrays.sort(a);

    int n=t;

    long max=0;

for(int i=0;i < t;i++)

{

        if(max<(a[i]*n))

        max = a[i]*n;

        n--;
    }
    System.out.println(max);
    System.exit(1);
}

} `


Save Spacemen spiff

$
0
0

hey i guys i have a problem and i am not getting how to solve it... help me some suggestions..

Problem 2: Save Spaceman Spiff

Spaceman Spiff has crash landed on Planet Quorg. He has to reach his ship quickly. But the evil Yukbarfs have stolen many Death Ray Blasters and have placed them along the way. You'll have to help him out!

Spaceman Spiff is initially at the top left corner (1,1) of a rectangular N × M grid . He needs to reach the bottom right corner (N,M). He can only move down or right. He moves at the speed of 1 cell per second. He has to move every second-that is, he cannot stop and wait at any cell.

There are K special cells that contain the Death Ray Blasters planted by the Yukbarfs. Each Blaster has a starting time t and a frequency f. It first fires at time t seconds, followed by another round at time t+f seconds, then at time t+2f seconds …. When a Blaster fires, it simultaneously emits four pulses, one in each of the four directions: up, down, left and right. The pulses travel at 1 cell per second.

Suppose a blaster is located at (x,y) with starting time t and frequency f. At time t seconds, it shoots its first set of pulses. The pulse travelling upwards will be at the cell (x,y-s) at time t+s seconds. At this time, the pulse travelling left will be at cell (x-s,y), the pulse travelling right will be at cell (x+s,y) and the pulse travelling down will be at cell (x,y+s). It will fire next at time t+f seconds. If a pulse crosses an edge of the grid, it disappears. Pulses do not affect each other if they meet. They continue along their original path. At any time, if Spaceman Spiff and a pulse are in the same cell, he dies. That is the only way pulses interact with Spaceman Spiff. Given these, you should find the least time (in seconds) in which Spaceman Spiff can reach his ship safely.

As an example consider a 4×4 grid that has only one Blaster, at (3,2), with starting time 1 and frequency 3. In the grids below, S denotes Spaceman Spiff, B denotes the blaster and P denotes a pulse. The sequence of grids describes a successful attempt to reach his ship that takes 6 seconds.

   t=0                t=1                t=2                t=3  
S  .  .  .         .  S  .  .         .  .  S  .         .  P  .  S
.  .  .  .         .  .  .  .         .  P  .  .         .  .  .  .
.  B  .  .         .  P  .  .         P  B  P  .         .  B  .  P
.  .  .  .         .  .  .  .         .  P  .  .         .  .  .  .



   t=4                t=5                t=6
.  .  .  .         .  .  .  .         .  P  .  .
.  .  .  S         .  P  .  .         .  .  .  .
.  P  .  .         P  B  P  S         .  B  .  P
.  .  .  .         .  P  .  .         .  .  .  S

Input format

Line 1: Three space separated integers N, M and K, describing the number of rows and columns in the grid and the number of Blasters, respectively.

Lines 2 to K+1: These lines describe the K blasters. Each line has four space separated integers. The first two integers on the line denote the row and column where the Blaster is located, the third integer is its starting time, and the fourth integer is its frequency.

Output format

The first line of output must either consist of the word YES, if Spaceman Spiff can reach his ship safely, or the word NO, if he cannot do so. If the output on the first line is YES then the second line should contain a single integer giving the least time, in seconds, that it takes him to reach his ship safely.

Sample Input 1

4 4 1
3 2 1 3



Sample Output 1

YES
6



Sample Input 2

5 5 2
5 1 1 2
4 4 1 2



Sample Output 2

YES
8

Computing Olympiad Problem Doubt!

$
0
0

I am a grade 12 student from Mumbai. I am planning to appear for the Zonal Computing Olympiad this Saturday which is for school students. I am facing a problem regarding a particular question from ZCO 2012. There is a test page where users can submit the solution and receive the results. I have submitted my solution however it says that the answer is wrong. It says that the program compiled successfully without any errors or warnings. The problem gives the right answer on my machine for the given example. I provide the question and my code below:

Question:

Zonal Computing Olympiad 2012, 26 Nov 2011 10:00 am-1:00 pm IST Problem 1 : Matched Brackets

A sequence of opening and closing brackets is well-bracketed if we can pair up each opening bracket with a matching closing bracket in the usual sense. For instance, the sequences (), (()) and ()(()) are well-bracketed, while (, ()), (()(), and )( are not well-bracketed.

The nesting depth of a well-bracketed sequence tells us the maximum number of levels of inner matched brackets enclosed within outer matched brackets. For instance, the nesting depth of () and ()()() is 1, the nesting depth of (()) and ()(()) is 2, the nesting depth of ((())) is 3, and so on.

Given a well-bracketed sequence, we are interested in computing the following:

The nesting depth, and the first position where it occurs-this will be

the position of the first opening bracket at this nesting depth, where the positions are numbered starting with 1.

The maximum number of symbols between any pair of matched brackets,

including both the outer brackets, and the first position where this occurs-that is, the position of the first opening bracket of this segment.

For instance, the nesting depth of ()(())()(()())(()()) is 2 and the first position where this occurs is 4. The opening bracket at position 10 is also at nesting depth 2 but we have to report the first position where this occurs, which is 4.

In this sequence, the maximum number of symbols between a pair of matched bracket is 6, starting at position 9. There is another such sequence of length 6 starting at position 15, but this is not the first such position. Input format

The input consists of two lines. The first line is a single integer N, the length of the bracket sequence. Positions in the sequence are numbered 1,2,…,N. The second line is a sequence of N space-separated integers that encode the bracket expression as follows: 1 denotes an opening bracket ( and 2 denotes a closing bracket ). Nothing other than 1 or 2 appears in the second line of input and the corresponding expression is guaranteed to be well-bracketed. Output format

Your program should print 4 space-separated integers in a line, denoting the four quantities asked for in the following order: nesting depth, first position that achieves the nesting depth, length of the maximum sequence between matching brackets and the first position where such a maximum length sequence occurs. Testdata

You may assume that 2 ? N ? 105. In 30% of the test cases, 2 ? N ? 103. Sample Input

20 1 2 1 1 2 2 1 2 1 1 2 1 2 2 1 1 2 1 2 2

Sample Output

2 4 6 9

Time and memory limits

The time limit for this task is 1 second. The memory limit is 32MB.

My submitted solution is:

#include "iostream"
#include<stdio.h>
using namespace std;

int main()
{
    unsigned int i,n,o,c,dep,pos_d,pos_m,last_pos,max;
    char* arr,*rn;
    cin>>n;
    fflush(stdin);
    arr = new char [2*n];
    rn = fgets(arr, (2*n), stdin);
    c=o=dep=pos_d=pos_m=last_pos=max=0;
    for(i=0;arr[i];i++)
    {
        if(arr[i]==' ')
            continue;

        else if(arr[i]=='1')
        {
            o++;
            if(c>0)
                c--;
            else
            {
                dep++;
                pos_d = (i/2)+1;
            }
        }

        else if(arr[i]=='2')
        {
            c++;
            if(o>0)
                o--;
            if(o==0)
            {
                if(((i-last_pos+2)/2)>max)
                {
                    max=(i-last_pos+2)/2;
                    pos_m = 1+(last_pos+1)/2;
                }
                last_pos = i+1;
            }
        }
    }
    cout<<dep<<" "<<pos_d<<" "<<max<<" "<<pos_m;
    return 0;
}

Kindly help me find the problem as I don't see any error and I seem to be getting the right answer for the given example.

Some useful links:

ZCO 2012 Question paper: http://www.iarcs.org.in/inoi/2012/zco2012/zco2012-1a.php Test server site: http://www.iarcs.org.in/zco2013/index.php

IARCS Problem Archive Online Judge giving error in Java?

$
0
0

Hi Everyone.

I'm new to competitive programming and appeared for ZIO this year. I'm getting 50 marks according to the answer key given on this forum, so I was preparing for the INOI.

Here in the Practise Problems for the Lead Game Problem (here) I have successfully submitted and obtained complete result for the problem, however when I submit the same code on the IARCS OPC website, it gives me a '0 not returned error' although the code ends with a System.Exit(0);.

I know that most of the people here have experience in c++, but I'm hoping anybody having an idea about this problem in Java might help me out with it.

Thanks.

ZCO 2015 ERROR IN SUBMITTING CODE

$
0
0

Okay so for the past one day I've been trying to practice on the ZCO Practice online judge(filled with problems from previous ZCOs) but whenever I try to submit a .cpp file it gives me this error- "Cannot recognize submission's language". Why is it happening?

Btw I tried to submit the same file on other online judges just to check and it gets submitted without any hassles! Some of my friends are also facing the same issue. Please help..

GSS5 SPOJ EXPLANATION

$
0
0

GSS5 In this sum I can't understand why can't we take the minimum of x1,y1,x2,y2 as the lower limit and maximum of those as the higher limit and then find the bestsum of (lower,higher) Can anyone explain this??

ZCO practice server INOI 2013 problem SequenceLand

$
0
0

Can anyone point out what's wrong with my code:

#include <cstdio>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> inp,ins,p,q;
vector<int>::iterator mn;
int main(){
    freopen(".in","r",stdin);
    freopen(".out","w",stdout);
    int n,k,m,l,c=0;
    scanf("%d %d",&n,&k);
    scanf("%d",&m);
    for(int j=0;j<m;j++){
        scanf("%d",&l);
        p.push_back(l);
    }
    sort(p.begin(),p.end());
    for(int i=1;i<n;i++){
        scanf("%d",&m);
        for(int j=0;j<m;j++){
            scanf("%d",&l);
            inp.push_back(l);
        }
        sort(inp.begin(),inp.end());
        mn=set_intersection(inp.begin(),inp.end(),p.begin(),p.end(),ins.begin());
        if((int)ins.size()>=k){
            c++;
            mn=set_union(p.begin(),p.end(),ins.begin(),ins.end(),q.begin());
            p.assign(q.begin(),q.end());
            sort(p.begin(),p.end());
        }
        ins.clear();
        inp.clear();
        q.clear();
    }
    printf("%d",c);
    return 0;
}

Little Red Riding Hood (ZCO '14)


SUPW(ZCO'14)

Doubt with subsets values in December challenge problem XORSUB..

$
0
0

I am sorry if anyone feel this thread violates the rules & regulations of on-going contest and he/she may remove this thread.

Problem Link : http://www.codechef.com/DEC14/problems/XORSUB

I am unable to understand the concept of subsets and in problem XORSUB from December Challenge.

F({}) = 0

F({1}) = 1

F({1,2}) = 3

F({1,3}) = 2

F({1,2,3}) = 0

F({2}) = 2

F({2,3}) = 1

F({3}) = 3

As this is given in problem explanation part, i an unable to understand how to derive the values of F(P).
Please help!!

SANSKAR , December Challenge

!!!!!!!!!!!!!SPOT THE ERROR IF U CAN!!!!!!!!!!!!!!!!!!!(factorial of large no,c++)

$
0
0

I spent 12 hours and i get o/p in dev c++ but wrong answer message here. Thanks in advance.

include<iostream>

using namespace std;

int multiply(int *b,int m,int j) {int sum[1000],c=0,l; while(m>1)

{ for(int i=0;i<j;i++) { sum[i]=((b[i]m)+c)%10; c=((b[i]m)+c)/10;

}

m--; for(int i=0;i<j;i++) {

    b[i]=sum[i];
}

}

for(l=j-1;sum[l]==0;l--) { } for(int i=l;i>=0;i--) { cout<<sum[i]; } return 0; }

int main() {int t;

cin>>t;

for(int v=0;v<t;v++) {

int n,m,j=0; int a[1000];

    cin>>n;

if(n!=1&&n!=2) {

    m=n-1;
while(n!=0)
{

a[j]=n%10;  
j++;
n=n/10;
}

while(j<170)
{

a[j]=0;
j++;

} multiply(a,m,j); }

else {if(n==2) cout<<2;

else cout<<1; } }return 0; }

Getting frustrated

$
0
0

what wrong in this code!! it works fine in codeblocks and ideone but when i submitted this solution on spoj then it will raise exception i.e SIGSEGV .... HOW can i sort out this issue plz help me

#include <cstdio>
#include <string.h>

#include <iostream>

using namespace std;

void markMultiples(bool arr[], int a, int n)
{
    int i = 2, num;
    while ( (num = i*a) <= n )
    {
        arr[ num-1 ] = 1; 
        ++i;
    }
}


void SieveOfEratosthenes(int a, int n)
{

    if(a<2){
        a=2;
    }
    if (n >= 2)
    {

        bool arr[n];
        memset(arr, 0, sizeof(arr));

                for (int i=1; i<n; ++i)
        {
            if ( arr[i] == 0 )
            {

                if((i+1)>=a && (i+1)<=n)
                printf("%d\n", i+1);
                markMultiples(arr, i+1, n);
            }
        }
    }
}

int main()
{
int n;
cin>>n;
while(n--)
{
    int a,b;
    cin>>a>>b;
    SieveOfEratosthenes(a,b);
}


return 0;
}

http://www.spoj.com/problems/PRIME1/

Plz help !!

Statistics DEC 2014

$
0
0

Hi all,

contest is starting slowly this time, but weekend is in front of us...

Current statistics:

CHEFPRES:  4[>= 100.0]
SANSKAR: 180[>= 20.0] /  158[>= 80.0]  /  121[>= 100.0]
CHEFBR:   69[>= 15.0] /   38[>= 90.0]
DIVIDEN:   3[>= 25.0] /    1[>= 100.0]
KALKI:    14[>= 0.0]  /    0[>= 20.0]  /    0[>= 40.0]  /    0[>= 60.0] / 0[>= 80.0]
XORSUB:  809[>= 30.0] /  319[>= 70.0]  /  262[>= 100.0]
RIN:       5[>= 20.0] /    3[>= 100.0]
CAPPLE: 2912[>= 27.0] / 2619[>= 52.0]  / 1658[>= 73.0]  / 1655[>= 75.0] / 1653[>= 100.0]

DISCHAR (using Python)

$
0
0

I am a novice at Python, and fully new to CodeChef. I feel like the November 2014 "DISCHAR" problem ( http://www.codechef.com/problems/DISCHAR ) should be (/is?) within my ability level, but my solutions all flunked. Any help understanding where I went wrong (code itself, understanding the question, understanding what format the input will be, some aspect of submitting to this particular site) would be very much appreciated.

Here is my code, which seems to work fine in the interpreter I'm using:

def dsc(t):
    used = ""
    for lets in t:
        if lets not in used:
            used = used + lets
    print len(used)

What am I doing wrong?


ZIO 2015 Discussion

$
0
0

EDIT: These are the Answers for this years zio. In case of any discrepancy Write your answer and tag me.

>     Q1)a)7300000000, b)5322222, c)9666666666
>     Q2)a)90, b)146,  c)585
>     Q3)a)123, b)72, c)107
>     Q4)a)10, b)9, c) 12

Wasn't it easy this year ?

Data Structures and Algorithms

$
0
0

Hi all, I need your help to make a list of most used data structures and algorithms along with their tutorials, implementation and some problems on them. It will be helpful to everyone in many ways. I request everyone to contribute to this list by providing links to tutorials, problems, etc. I will keep updating this list regularly.

  1. Binary Search : Tutorial, Problems, Tutorial, Implementation, Problem

  2. Quicksort : Tutorial, Implementation, Tutorial

  3. Merge Sort : Tutorial, Implementation, Tutorial

  4. Suffix Array : Tutorial, Tutorial, Implementation, Tutorial, Implementation, Problem, Problem

  5. Knuth-Morris-Pratt Algorithm (KMP) : Tutorial, Tutorial, Implementation, Tutorial, Problem

  6. Rabin-Karp Algorithm : Tutorial, Implementation, Tutorial, Problem, Problem

  7. Tries : Tutorial, Problems, Tutorial : I,II, Tutorial, Problem, Problem, Problem

  8. Depth First Traversal of a graph : Tutorial, Impelementation, Tutorial, Problems, Problem, Problem, Problem

  9. Breadth First Traversal of a graph : Tutorial, Impelementation, Tutorial, Problems, Problem, Problem, Problem, Flood Fill

  10. Dijkstra's Algorithm : Tutorial, Problems, Problem, Tutorial(greedy), Tutorial (with heap), Implementation, Problem, Problem

  11. Binary Indexed Tree : Tutorial, Problems, Tutorial, Original Paper, Tutorial, Tutorial, Problem, Problem, Problem, Problem, Problem, Problem, Problem

  12. Segment Tree (with lazy propagation) : Tutorial, Implementation, Tutorial, Tutorial, Problems, Implementation, Tutorial, Implementation and Various Uses, Persistent Segment Tree, problems same as BIT, Problem, Problem/HLD is used as well/

  13. Z algorithm : Tutorial, Problem, Tutorial, problems same as KMP.

  14. Floyd Warshall Algorithm : Tutorial, Implementation, Problem, Problem

  15. Sparse Table(RMQ) : Tutorial, Problems, Tutorial, Implementation(C++), Java implementation

  16. Heap / Priority Queue / Heapsort : Implementation, Explanation, Tutorial, Implementation, Problem, Chapter from CLRS

  17. Modular Multiplicative Inverse

  18. nCr % M

  19. Suffix Automaton : Detailed Paper, Tutorial, Implementation (I), Tutorial, Implementation (II), Problem, Problem, Problem, Problem, Tutorial, Implementation

  20. Lowest Common Ancestor : Tutorial, Problems, Paper, Paper, Problem, Problem, Problem

  21. Counting Inversions : Divide and Conquer, Segment Tree, Fenwick Tree, Problem

  22. Euclid's Extended Algorithm

  23. Suffix Tree : Tutorial, Tutorial, Intro, Construction : I, Implementation, Implementation, Problem, Problem, Problem, Problem

  24. Dynamic Programming : Chapter from CLRS(essential), Tutorial, Problems, Problem, Problem, Problem, Problem, Tutorial, Problem, Problem, Problem, Longest Increasing Subsequence, Bitmask DP, Bitmask DP, Optimization, Problem, Problem, Problem, Problem, Problem, Problem, Problem, DP on Trees : I, II

  25. Basic Data Structures : Tutorial, Stack Implementation, Queue Implementation, Tutorial, Linked List Implementation

  26. Logarithmic Exponentiation

  27. Graphs : Definition, Representation, Definition, Representation, Problem, Problem

  28. Minimum Spanning Tree : Tutorial, Tutorial, Kruskal's Implementation, Prim's Implementation, Problem, Problem, Problem, Problem, Problem

  29. Efficient Prime Factorization

  30. Combinatorics : Tutorial, Problems, Problem, Tutorial

  31. Union Find/Disjoint Set : Tutorial, Tutorial, Problems, Problem, Problem, Problem

  32. Knapsack problem : Solution, Implementation

  33. Aho-Corasick String Matching Algorithm : Tutorial, Implementation, Problem, Problem, Problem, Problem

  34. Strongly Connected Components : Tutorial, Implementation, Tutorial, Problem, Problem, Problem

  35. Bellman Ford algorithm : Tutorial, Implementation, Tutorial, Implementation, Problem, Problem

  36. Heavy-light Decomposition : Tutorial, Problems, Tutorial, Implementation, Tutorial, Implementation, Implementation, Problem, Problem, Problem

  37. Convex Hull : Tutorial, Jarvis Algorithm Implementation, Tutorial with Graham scan, Tutorial, Implementation, Problem, Problem, Problem, Problem, Problem

  38. Line Intersection : Tutorial, Implementation, Tutorial, Problems

  39. Sieve of Erastothenes

  40. Interval Tree : Tutorial, Implementation, Problem, Problem, Problem, Problem, Problem, Problem, Tutorial

  41. Counting Sort

  42. Probabilities

  43. Matrix Exponentiation : Tutorial, Tutorial

  44. Network flow : (Max Flow)Tutorial : I,II, Max Flow(Ford-Fulkerson) Tutorial, Implementation, (Min Cut) Tutorial, Implementation, (Min Cost Flow)Tutorial : I,II,III, Dinic's Algorithm with Implementation, Max flow by Edmonds Karp with Implementation, Problem, Problem, Problem, Problem, Problem, Problem, Problem, Problem, Problem, Problem, Problem, Problem, Problem, Problem, Problem

  45. K-d tree : Tutorial, Tutorial, Implementation, Problem

  46. Deque

  47. Binary Search Tree : Tutorial, Implementation, Searching and Insertion, Deletion

  48. Quick Select : Implementation, Implementation

  49. Treap/Cartesian Tree : Tutorial(detailed), Tutorial, Implementation, Uses and Problems, Problem, Problem

  50. Game Theory : Detailed Paper, Tutorial, Problems, Grundy Numbers, Tutorial with example problems - I,II,III,IV, Tutorial, Problems, Problem, Problem, Problem, Problem, Problem, Problem, Problem, Problem, Problem, Problem, Problem, Nim

  51. STL (C++) : I,II, Crash Course

  52. Maximum Bipartite Matching

  53. Manacher's Algorithm : Implementation, Tutorial, Tutorial, Implementation, Tutorial, Implementation, Problem, Problem, Problem

  54. Miller-Rabin Primality Test : Code

  55. Stable Marriage Problem

  56. Hungarian Algorithm, Tutorial

  57. Sweep line Algorithm : I, II

  58. LCP : Tutorial, Implementation, Tutorial, Implementation

  59. Gaussian Elimination

  60. Pollard Rho Integer Factorization, problem

  61. Topological Sorting

  62. Detecting Cycles in a Graph : Directed - I, II Undirected : I

  63. Geometry : Basics, Tutorial

  64. Backtracking : N queens problem, Tug of War, Sudoku

  65. Eulerian and Hamiltonian Paths : Tutorial, Tutorial, (Eulerian Path and Cycle)Implementation, (Hamiltonian Cycle)Implementation

  66. Graph Coloring : Tutorial, Implementation

  67. Meet in the Middle : Tutorial, Implementation

  68. Arbitrary Precision Integer(BigInt), II

  69. Radix Sort, Bucket Sort

  70. Johnson's Algorithm : Tutorial, Tutorial, Implementation

  71. Maximal Matching in a General Graph : Blossom/Edmond's Algorithm, Implementation, Tutte Matrix, Problem

  72. Recursion : I,II, Towers of Hanoi with explanation

  73. Inclusion and Exclusion Principle : I, II

  74. Co-ordinate Compression

  75. Sqrt-Decomposition : Tutorial, Tutorial, Problem, Problem

  76. Link-Cut Tree : Tutorial, Wiki, Tutorial, Implementation, Problem, Problem, Problem, Problem

  77. Euler's Totient Function : Explanation, Implementation, Problems, Explanation, Problems

  78. Burnside Lemma : Tutorial, Tutorial, Problem

  79. Edit/Levenshtein Distance : Tutorial, Introduction, Tutorial, Problem, Problem

  80. Branch and Bound

  81. Math for Competitive Programming

How to resolve time limit exceed error from my program

$
0
0

http://www.codechef.com/problems/TSORT/

include <iostream>

include <algorithm>

using namespace std;

int main() { int n; cin>>n; int s[n]; for(int k=0;k<n;k++) cin="">>s[k]; sort(s,s+n); for(int m=0;m<n;m++ cout<<s[m]<<endl; return 0; }

I can't understand why it is giving time limit exceed and which sorting algorithm does sort(s,s+n) uses and what's is complexity ?? plz also suggest me some other algo to reduce complexity of my program!!

Justify that the min-heap property can not be used to print out the keys of an n-node tree in sorted order in O(n) time?

$
0
0

I've some intuition that why this is true. Since a min heap just tells the minimum element and the relationship between only parent and its children is known. There is no information about the relative ordering of elements in different sub trees of a same root. Thus it has to take more than O(n). But I want to know how to answer such questions with solid logic.

Prove that no matter what node we start at in a height-h binary search tree, k successive calls to "tree-successor" take O(k+h) time?

$
0
0

Prove that no matter what node we start at in a height-h binary search tree, k successive calls to "tree-successor" take O(k+h) time?

Viewing all 39796 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>