Preloader

ALGOHOLICS


The Rulebook

  1. All B.Tech undergraduates are allowed to enrol in the competition.
  2. You will enrol as a team of two with both members of the same college.
  3. The competition will have 5 levels where at each level a set of questions will be assigned to groups of teams with one group having a common set of questions.
  4. The result submission will be in the form of a pseudo code as well as a compiled C program with the code.
  5. The marking will be based on the successful submission of both the above and then on the complexities of the designed code.
  6. The levels will be time bound starting ‘zero’ at 20 minutes and each further level will have 10 minutes more.
  7. The final level will have two teams and the winner will be announced on the same day.

So put on your thinking caps, and code!

 

Sample Question

A unit fraction contains one in the numerator. The decimal representation of unit fractions with denominator 2 – 10 are given.

  • ½ = 0.5
  • 1/3 = 0.(3)
  • ¼ = 0.25
  • 1/5 = 0.2
  • 1/6 = 0.1(6)
  • 1/7 = 0.(142857)
  • 1/8 = 0.125
  • 1/9 = 0.(1)
  • 1/10 = 0.1

Find the value of d < 1000 for which 1/d consists of the longest recurring cycle in its decimal fraction part.

 

Sample Algorithm Question

Write an efficient C program to find the sum of contiguous subarray within a one-dimensional array of numbers which has the largest sum.

Kadane’s Algorithm:

Initialize:
max_so_far = 0
max_ending_here = 0
Loop for each element of the array
a) max_ending_here = max_ending_here + a[i]
b) if(max_ending_here < 0)
max_ending_here = 0
c) if(max_so_far < max_ending_here)
max_so_far = max_ending_here
return max_so_far