Posts

Showing posts with the label dsps

Algorithm

me ami belong to computer stream , often hear my teachers talking about taking important lectures(that i somehow n accidentally happen to skip) on algorithms , so here i am filling up on those missed lectures ;) so getting back to the  TOPIC what's an algorithm ??? Lets say an algorithm is  any well-defined computational procedure that takes some value, or set of values, as input and produces some value, or set of values, as output. so its just like those maths sums that we've been solving all our lives,  those are just fool-proof steps that run around in a loop while the computer does the calculations..... for example:- say a linear search .... basically its the most basic and the simplest of all.... just to  summarize :- we go through the values one-at-a-time in a linear way (be it ascending or descending-but mostly ascending) say example we need to find number 6  from a given set of numbers(let the numbers be in an array) [8,1,4...

Rules for drawing a FLOWCHART

Image
Terminator All flowcharts start and end with the terminator or terminal shape. This is a rounded rectangle and is shown below. You use this same shape for both the start and the end. You will see some charts with slightly different terminal shapes. For example, sometimes an oval is used. This is because there is no golden standard for flowcharting. Different companies and different technical areas use different shapes. There are a few basic rules and, beyond that, you can create your own rules for your organization. If you add your own shapes, it is important that you explain what they are used for, so others can understand your chart. Just click on the terminator shape in the stencil and then type in the text.   To read a flowchart, you follow the arrows from shape to shape. To draw a line in RFFlow, click on the line in the stencil at the left and then drag the mouse to draw the line in your chart. It is faster to place all your shapes first and t...

DSPS: paper boy (dfs traversal_graph)

//============================================================================ // Name        : newpaper_boy.cpp // Author      : Parashar // Version     : // Copyright   : Do not try this at home // Description : Hello World in C++, Ansi-style //============================================================================ #include <iostream> using namespace std; #define True 1 #define False 0 #define size 10 class graph { public:     int n,e;     int g[size][size],q[size];     int front,rear;     int visit[size]; int dist; public:     graph();     void create();     void dfs(int);     void visited(); }; graph::graph() {     front=rear=-1;     for(int v1=0;v1<size;v1++)     {   ...

DSPS: Revised version of GRAPHS (BFS)

#include<iostream> using namespace std; #define size 10 #define true 1 #define false 0 class graph { public:     int g[size][size];     int visit[size],rear,front,q[size];     int n,e; public:     graph();     void getmatrix();     void displaygraph();     void bfs(int); }; graph::graph() {  for(int i=0;i<size;i++)      {          for(int j=0;j<size;j++)          {              g[i][j]=false;          }      }  for(int i=0;i<size;i++)      {      visit[i]=false;      } } void graph::getmatrix() {     int v1,v2;     cout<<"Enter no. of n...

DSPS: Shopping mall

//============================================================================ // Name        : queue.cpp // Author      : Parashar // Version     : Final // Copyright   : Do not try this at home // Description : Hello World in C++, Ansi-style //============================================================================ #include <iostream> #include<string.h> using namespace std; #define size 5 class fruit { public:     char name[10];     int count;     int price; }; class vegetables { public:     char name[10];     int count;     int price; }; class QUEUE {     fruit F[size];     vegetables V[size];     int ffront,frear,vfront,vrear; public:     QUEUE();     void finsert();   ...

DSPS: CDLL (final update with output)

//============================================================================ // Name        : cdll.cpp // Author      : Parashar // Version     : // Copyright   : Do not try this at home ;P // Description : Hello World in C++, Ansi-style //============================================================================ #include <iostream> using namespace std; class cdll     {       public:            struct node              {                int data;                struct node *next,*prev;              }*head;       public: ...

DSPS: Vegetable_vendor

//============================================================================ // Name        : p_queue.cpp // Author      : Parashar // Version     : // Copyright   : Do not try this at home ;P // Description : Hello World in C++, Ansi-style //============================================================================ #include <iostream> #include<string.h> using namespace std; #define size 5 class fruit { public:     char name[10];     int count;     int price; }; class vegetables { public:     char name[10];     int count;     int price; }; class QUEUE {     fruit F[size];     vegetables V[size];     int ffront,frear,vfront,vrear; public:     QUEUE();     void finsert();   ...

DSPS: CDLL

//============================================================================ // Name        : cdll.cpp // Author      : Parashar // Version     : // Copyright   : Do not try this at home ;P // Description : Hello World in C++, Ansi-style //============================================================================ #include <iostream> using namespace std; class cdll     {       public:            struct node              {                int data;                struct node *next,*prev;              }*head;       public:          ...

DSPS: TIC TAC TOE

//============================================================================ // Name        : Tic_tac.cpp // Author      : Parashar // Version     : // Copyright   : Do not try this at home ;P // Description : Hello World in C++, Ansi-style //============================================================================     #include <iostream>     using namespace std;     class tictactoe     {     public:         char block[10];     public:         tictactoe();         int checkwin() ;         void board();     };     tictactoe::tictactoe()     {         block[1]='1';     ...

DSPS: Dictionary(word+meaning)

#include <iostream> #include<string.h> using namespace std; class node { public:     char word[10];     char meaning[10];     node *left;     node *right; }; class tree { public:     node *root,*n; public:     tree();     void create();     void insert(node*,node*);     void search(node*);     void inorder(node*);     void del(node*); }; tree::tree() {     root=NULL; } void tree::search(node *temp) {     char key[10];     cout<<"enter the word u wanna search";     cin>>key; int found=0;     do      {       if(strcmp(temp->word,key)==0)       {           found=1;      ...

DSPS: tree(char)

//============================================================================ // Name        : char_tree.cpp // Author      : Parashar // Version     : // Copyright   : Do not try this at home ;P // Description : Hello World in C++, Ansi-style //============================================================================ #include <iostream> #include<string.h> using namespace std; class node { public:     char data[10];     node *left;     node *right; }; class tree { public:     node *root,*n; public:     tree();     void create();     void insert(node*,node*);     void inorder(node*);     void preorder(node*);     void postorder(node*); }; tree::tree() {     root=NULL; } void tree::c...

C++: Binary search tree(bst)

//============================================================================ // Name        : Tree.cpp // Author      : Parashar // Version     : 1.00 // Copyright   : Do not try this at home ;p // Description : Hello World in C++, Ansi-style //============================================================================ #include <iostream> using namespace std; class node { public:     int data;     node *left;     node *right; }; class tree { public:     node *root,*n; public:     tree();     void create();     void insert(node*,node*);     void inorder(node*);     void preorder(node*);     void postorder(node*);     void search(node*); }; tree::tree() {     root=NULL; } void...