Algorithm / Data Structure
Euler Tour Traversal of Binary Tree
Algorithm:
eulerTour(Node t)
if t ≠ null
if t is a leaf node
visit t
else
visit t // on the left
eulerTour(t.left);
visit t; // from below
eulerTour(t.right);
visit t; // on the right
Euler Tour Traversal of Binary Search Tree
Euler Tour Traversal is a generic traversal of a binary tree. It walks around the tree and visit each node three times:
- on the left, before the Euler tour of the node's left subtree
- from below, as we finish the tour of the left subtree
- on the right, after we finish the Euler tour of the right subtree.
note: if the node is a leaf, we consider the visits to all occur at once
Below is a Euler Tour Traversal implementation in Java. The program will create a Binary Search Tree and then traverse in Euler Tour.
Reverse Integer in C Language using Modulo
#include<stdio.h>
void main() {
int n;
int mod;
int rev = 0;
printf("ENTER AN INTEGER: ");
scanf("%d", &n);
while( n > 0 ) {
mod = n % 10;
rev = rev * 10 + mod;
n = n / 10;
}
printf("REVERSED: %d\n", rev);
}
Activation Record Instance
Activation Records (call stack) - machine dependent data structures containing subroutine state information. Each stack frame (Activation Record Instance) corresponds to a call to a subroutine w/c has not yet terminated with a return.
Merge Sort - A sort algorithm that splits the items to be sorted into two groups, recursively sorts each group, and merges them into a final, sorted sequence.
Merge Sort Algorithm
Merge sort is a divide and conquer comparison-based sorting algorithm.
Algorithm:
- If the list is of length 0 or 1, then it is already sorted. Otherwise:
- Divide the unsorted list into two sublists of about half the size.
- Sort each sublist recursively by re-applying the merge sort.
- Merge the two sublists back into one sorted list.
minesweeper square
Input
The first line contains 2 integers (should be separated by a comma) cols and rows which represent the number of lines and columns of the field, respectively. Each of the next rows lines contains exactly cols character '.' or '*' with spaces, representing the field. '.' for safe squares and '*' for mine squares, both without a quote.
Output
'.' characters if any, replaced by the number of mines ('*') adjacent to that cell.
The 3n + 1 Problem
Algorithm:
- Start with an integer n.
- If n is even, divide by 2.
- If n is odd, multiply by 3 and add 1.
- Repeat the process with the new value of n, terminating when n = 1.

Mobile Robotics Workshop - 3rd Session
Its our third session in Mobile Robotics Workshop. Five problems were given to be programmed in C. Although I prefer GCC (Gnu compiler collection) than Turbo C, I dont have a choice. Its not my pc. Its Windows XP. Not Linux!!! Not GNU!!!
Here are the problems:
Factorial Program in Python
The factorial of a positive integer n, denoted by n!, is the product of all positive integers less than or equal to n. For example, 6! = 1 x 2 x 3 x 4 x 5 x 6 = 720. Below is a python program to identify this number.

Recent comments
6 days 22 hours ago
1 week 20 hours ago
2 weeks 2 hours ago
2 weeks 15 hours ago
2 weeks 4 days ago
7 weeks 3 days ago
8 weeks 6 days ago
9 weeks 1 hour ago
13 weeks 2 days ago
13 weeks 3 days ago