3 Ants Triangle Puzzle

Triangle ants problem Three ants on the corners of an equilateral triangle. They started moving along the edges at the same speed. What is the probability that the ants will collide ? Solution Each ant could possibly be moving in one direction let us say Left or Right. We have three ants with two possible

Word count perl script

Find word count using perl Write a perl program that prints word count in file. For example if the input file contains the following word occurrences "Santa Clara is located in Santa Clara county" the program should print something like: Santa: 2 Clara: 2 is: 1 located: 1 in: 1 county: 1 Word count perl

Perl compare two arrays

Two arrays differences Given two integer arrays A and B of the same size each having no duplicate values. Write an equality function that returns true if A and B are equivalent. The arrays are equivalent if they contain the same content regardless of order. The function should return false if the arrays are not

Recursive max function

Recursive function to find max in array Write a recursive function to find the maximum value element in an Array of size N. Recursive definition of maximum In order to solve this problem recursively we need a stopping condition to break the chain of recursive calls. We also need to represent the solution for an array