arjun95's blog

By arjun95, history, 6 years ago, In English

how to solve discrete logarithm over composite modulus, i know over prime modulo using Baby-step giant-step algorithm, but in case of composite modulus i have no idea how to solve this. i think this can be done by factorization of modulo and chinese remainder theorem but i don't know how to do this.

Full text and comments »

  • Vote: I like it
  • -1
  • Vote: I do not like it

By arjun95, history, 7 years ago, In English

Given a cost matrix (may contain negative values) and a man has some non-negative initial strength, he starts from zero(start) position and complete his journey at (n-1)th position with some non-negative power. matrix[i][j]>0 denotes he lost his strength from moving city i to j and matrix[i][j]<0 denotes he gain his strength by matrix[i][j]. he has to cover all the cities from 1 to n-2 and during his journey path his power may become negative but at the (n-1)th pos(destination) his power must be non-negative. we have to find whether he able to complete his journey or not.

test case-

         initial strength=1
         cost matrix = [0 2 2 -1]
                       [4 0 2 -1]
                       [4 2 0 -1]
                       [4 2 2 0]
         ans=YES 
         path is- 
         (0 -> 3 -> 1 -> 3 -> 2 -> 3)
         strength during its journey
         (1 -> 2 -> 0 -> 1 -> -1 ->0)

i have no idea how to solve this question please help.

Full text and comments »

  • Vote: I like it
  • +11
  • Vote: I do not like it

By arjun95, history, 7 years ago, In English

how to prove space complexity in segment tree is O(4*n).

Full text and comments »

  • Vote: I like it
  • +10
  • Vote: I do not like it

By arjun95, history, 7 years ago, In English

is there is a way to find out the total memory being consumed by my c++ program. is there is any tool or library by which i can find memory being consumed by my program.

Full text and comments »

  • Vote: I like it
  • +17
  • Vote: I do not like it