Monday 30 November 2015

Threaded Binary Tree

TBT - Threaded Binary Tree

In computing, a threaded binary tree is a binary tree variant that allows fast traversal: given a pointer to a node in a threaded tree, it is possible to cheaply find its in-order successor (and/or predecessor).

Below is an implementation of a TBT in C++ language.

Sunday 29 November 2015

Calendar - C Program

calendar-c-program
Calendar

How to create a Calendar ?

Creating a calendar is quite easy. Consider the following facts first.
  • A normal year has 365 days.
  • A leap year has 366 days.
  • Also 365%7=1 while 366%7==2
  • So normally if January1 is a Monday for a year x for the next year(x+1) January 1 will be Tuesday. However if year x is a leap year then for the next year January 1 will be a Wednesday.

Saturday 28 November 2015

Binary Search Tree Dictionary

  1. A dictionary can be either implemented using a linked list or  a binary search tree.
  2. Insertion and Searching in the former is more time consuming as compared to the later. Thus the later approach is preferred. 
  3. Each node will have 2 children.
  4. The values in the left subtree will be lesser than the parent and the values in the right subtree will be greater than the parent for each node.
  5. Threaded children have not been used in this data structure.
  6. This binary search tree can be balanced by using AVL tree method. This will further reduce the search time (searching in a skewed tree is equivalent to searching in a link list).
  7. Wikipedia Link for BST :- https://en.wikipedia.org/wiki/Binary_search_tree

Graphs Newspaper Boy Problem -CPP

Q:-Implement DFS ,BFS, Prim's and Kruskals algorithms so as to help the newspaper boy deliver the newspapers.

Solution
Language Used:-C++
  1. The graph is represented using array data structure. 
  2. DFS , BFS , Prim's and Kruskals are written using functions inside the classes 

AVL Tree

Wikipedia Link:-https://en.wikipedia.org/wiki/AVL_tree
An AVL tree is a self-balancing binary search tree.
Inventors:- Georgy Adelson-Velsky and Evgenii Landis

C++ Program for AVL tree

Friday 27 November 2015

Tic Tac Toe Java Program


Tic Tac Toe is classic game played using pen and paper.
For rules and more information please refer the following:-
Wikipedia article on tic tac toe:-
https://en.wikipedia.org/wiki/Tic-tac-toe

Below is the code for implementation of this all time classic in Java language.

Lsmovie-linux shell scripting

Do you have a ton of movies on your Linux Machine ? Do you wish that you could maintain a nice movie list, a list that lists all your movies ? Every time you someone asks for movies just show them the list.