Posts

Showing posts from 2012

LINKED LIST IMPLEMENTATION FOR GAME BATTLESHIP THROUGH C

LINKED LIST IMPLEMENTATION FOR GAME BATTLESHIP THROUGH C The game is played on four  grids , two for each player. The grids are typically square – usually 10×10 – and the individual squares in the grid are identified by letter and number. On one grid the player arranges ships and records the shots by the opponent. On the other grid the player records his/her own shots. Before play begins, each player secretly arranges their ships on their primary grid. Each ship occupies a number of consecutive squares on the grid, arranged either horizontally or vertically. The number of squares for each ship is determined by the type of the ship. The ships cannot overlap (i.e., only one ship can occupy any given square in the grid). The types and numbers of ships allowed are the same for each player. These may vary depending on the rules. REF:-  http://en.wikipedia.org/wiki/Battleship_(game) I have used Linked List For It's Implementation One Can Use Array too.....  _...

TIC-TAC-TOE THROUGH C

IMPLEMENTATION OF TIC-TAC-TOE THROUGH C :- From Wikipedia, the free encyclopedia. Tic-tac-toe, originally called noughts and crosses (and still known as this in Britain and Australia), Xs and Os (in Ireland) and X and 0 (in India) is a pencil-and-paper game for two players, X and O, who take turns marking the spaces in a 3×3 grid. The player who succeeds in placing three respective marks in a horizontal, vertical, or diagonal row wins the game. The following example game is won by the first player, X: Players soon discover that best play from both parties leads to a draw (often referred to as cat or cat's game). Hence, tic-tac-toe is most often played by young children. The friendliness of tic-tac-toe games makes them ideal as a pedagogical tool for teaching the concepts of good sportsmanship and the branch of artificial intelligence that deals with the searching of game trees. It is straightforward to write a computer program to play tic-tac-toe perfectly,...

DATA STRUCTURES INTERVIEW QUESTIONS

LINKED LIST INTERVIEW QUESTIONS Here Is One Of Most Asked Interview Question On Linked List !   We Have Given A List With Following Data :- 1->2->3->4->5->6->7->8->9->10 and k=3 Then Output Should Be :- 4->3->2->1->5->6->7->8->9->10 ------------------------------------------------------------------------------------------------------------------ Here Is A Solution To This Problem:- ------------------------------------------------------------------------------------------------------------------ #include<stdio.h> #include<conio.h> #include<stdlib.h> typedef struct ll { int data; struct ll *next; }mynode; mynode *start; void placestart(mynode **hd,int c); int numofnodes(mynode *hd); void addnode(mynode **hd,int data); void revinstyle(mynode **hd,int nonr); void printall(mynode *hd); void main() { int ch,data,nonr,count; mynode *head=NULL; clrscr(); do { printf("\n1.Add Data"); printf("\n2.Eno...

QUEUE IMPLEMENTATION USING LINKED LIST

     IMPLEMENTATION OF QUEUE BY LINKED LIST      I n computer science , a queue is a particular kind of abstract data type or collection in which the entities in the collection are kept in order and the principal (or only) operations on the collection are the addition of entities to the rear and removal of entities from the front. This makes the queue a First-In-First-Out (FIFO) data structure . In a FIFO data structure, the first element added to the queue will be the first one to be removed. This is equivalent to the requirement that once an element is added, all elements that were added before have to be removed before the new element can be invoked. A queue is an example of a linear data structure . Queues provide services in computer science , transport , and operations research where various entities such as data, objects, persons, or events are stored and held to be processed later. In these contexts, the queue ...