Posts

Multiplication Of Two Numbers With Help Of Linked List

Image
Multiplication Of Two Numbers With Help Of Linked List       It's A Multiplication Program Using Linked List That Means It Can Multiply Numbers That Are Bigger Than Range Of int , long int etc.. ............. #include<stdio.h> #include<conio.h> #include<stdlib.h> typedef struct ll { int digit; struct ll *next; }number; void add(number **hd,int i); void traverse(number *hd); void reverse(number **hd); void adds(char a[],number **hd); void addhead(number *hd1,number *hd); void mul(number *hd1,number **hd2); void multiply(number *hd1,int attempt,int x); void copy(number *hd); void freeh(number **hd); number *oh=NULL,*head3=NULL,*head4=NULL; void main() { number *head1=NULL,*head2=NULL; char a[500],b[500]; clrscr(); gets(a); gets(b); adds(a,&head1); adds(b,&head2); printf("___________"); printf("\nAnswer Is :|"); printf("\n-----------"); mul(head1,&head2); freeh(&head1); freeh(&head2); freeh(&oh); freeh(...

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...