Category Archives: Coding Discussions

Different programming problems, and its solutions discussed with source codes and explanations.

Number of trailing zeros in factorial of an integer

An integer n is given, the task is to find the number of trailing zeros in n! .

Posted in Coding Discussions, Computer Science, Others | Tagged , , , | Leave a comment

Find Sum (i … j) in a list

The problem is to sum the ith to jth element of a given list. The easiest solution runs in time, which starts are the ith index and adds up the numbers in the list until it reaches the jth index. … Continue reading

Posted in Coding Discussions, Computer Science | Tagged , , | Leave a comment

Find a String in an Alphabet Grid

Everybody of us has definitely played the word search game in which a grid of characters are given, and a list of words are given which are to be found in the grid horizontally, vertically or diagonally. In this post … Continue reading

Posted in Coding Discussions, Computer Science | Tagged , | Leave a comment

Towers of Hanoi Iterative process: simulating recursion

The last post Recursive Solution to Towers of Hanoi described the well-known recursive definition and implementation of the Towers of Hanoi problem. This post is an extension presenting the same problem iteratively by simulating the recursion stack. This implementation will … Continue reading

Posted in Coding Discussions, Computer Science | Tagged , | Leave a comment

Recursive Solution to Towers of Hanoi

Towers of Hanoi is a mathematical game or a puzzle in which there are three pegs, and some disks (originally 8) of different radius placed on top of one another such that no larger disk is placed on a smaller … Continue reading

Posted in Coding Discussions, Computer Science | Tagged , | 3 Comments

Allocating multidimentional array at runtime in C

Arrays in C language are static in nature, and cannot be resized at runtime. The effect of runtime allocation of an array could be achieved by hierarchically allocating blocks of memory at runtime. Below we discuss the mechanism to allocate … Continue reading

Posted in Coding Discussions, Computer Science, C Language | Tagged , | 2 Comments

Simpson’s 1/3rd Rule

A brief introduction to the Simpson’s 1/3rd rule and a uniform interval Composite Simpson’s 1/3rd Rule implementation.

Posted in Coding Discussions, Computer Science | Tagged , , | 1 Comment

Trapezoidal Rule

A brief introduction to the Trapezoidal rule and a uniform interval Composite Trapezoidal Rule implementation.

Posted in Coding Discussions, Computer Science | Tagged , , | 2 Comments

Balanced Parenthesis Check

Objective To check if an entered string containing nested parenthesis are balanced and valid. This write-up presents a function with which a string is checked for balanced parenthesis.

Posted in Coding Discussions, Computer Science | Tagged , | 5 Comments

GCD of n integers

Greatest Common Divisor Let a and b be integers, not both zero. The largest integer d such that d exactly divides both a and b is called the greatest common divisor of a and b . The GCD of the … Continue reading

Posted in Coding Discussions, Computer Science | Tagged , | Leave a comment