Posts

Showing posts from 2021
Data Structure First lesson in DataStructure 1st Question 2nd Question 3rd Question 4th Question 5th Question 6th Question 7th Question 8th Question

UNIT-I Data structure

Note:-please watch this blog in desktop mode. Below provide are links 1.Data Structure and it's types 2.Algorithm,Pseudocode, Flow-chat 3.Single-Dimensional Array 4.Two-dimensional Array 5.Multi-Dimensional-Array   6.Stack 7.Notations For Arthamati Expression 8.Converting Infix expression to postfix Is Comment:-Remaining question well be posted as soon as possible.

Stack

Image
  STACK >> stack is a linear Data Structure . i.e the data elements organised in sequential order like array. >> Stack is a static data structure, i.e it will stare limit elements. >>It is based on array concept. >>Stack is called FILO( first in last out ) i.e that elements which are inserted first displays last (or) LIFO( last in first out )i.e the elements which are inserted last displays first. TERMINOLOGY OF STACK >>Top of stack >>Over flow >>Under flow >>In stack insertion ,deletion will be held at only on end called 'Top' of stack. >>If stack is full, when you call member function push( ),if will display o/pas over flow. >>If stack is empty ,when you call member function pop( ),it will display o/p as under flow Functions of STACK 1.push() 2.pop() 3.show() 4.quit() Push():- It is a Member-function of a stack which is used to insert a new element, into stack . pop ():-It is a Member function, which is used to delet

Multi-dimensional Array

  A list of items can be given one variable name using more than two subscripts and such a variable is called multi-dimensional array. Three dimensional Array   A list of items can be given one variable name using three subscripts and such a variable is called three dimensional array. Declaration of Three Dimensional Array:- Syntax:-   Datatype  array_name[size of two dim array][nr][nc]; nr-->no.of rows nc-->no.of columns >>The data type specifies the type of elements that will be contained in array such as int float or char.   Initialising three dimensional array:  >>Like the one dimensional array three dimensional array may be initialised by  following their declaration with list of initial values enclosed in braces .  int table[2][2][3]={0,0,0,1,1,1,6,6,6,7,7,7}; >>This initializes the elements of first two dimensional (Matrix )First row zeros and the second row to own once and second Matrix elements are First row to sixs the second matrix to sevens. >>

Two Dimensional Array

Image
 In this data will be stored in form of rows and colums i.e. table. A list of items can be given one variable name using two subscripts and such a variable is called a two -subscripted variable or a two -dimensional array. Declaration syntax:- Data_type  array_name[nr][nc]; nr->no.of rows nc->no.of columns  Initialization:- int mat[2][3]=【{2,3,4}{5,6,7}】 i=0,j=0 1row,1col-->mat[0][0]=2; 1row,2col-->mat[0][1]=3; 1row,3col-->mat[0][2]=4; . . . 2row,3col-->mat[1][2]=7; In above example  int is data type  Mat is array name 2 is  total no.of rows 3 is total no.of columns 2,3,4,5,6,7 is elements Program on two dimensional array (Addition of two matrix) #include <iostream.h> #include <conio.h> class arr { int a[10][10],b[10][10],i, j,nr,nc;   public: void acc(); void add(); }; void arr::acc() { cout<<"enter no of roos and colomus \n"; cin>>nr>>nc; cout << "enter array values of a\n"; for (i = 0; i < nr; i++) { for (j

Infix to postfix converstion

  Infix to Postfix Conversation  Procedure :- 1.Scan the infix string from left to right . 2.Initialise an empty stack  3.If the scanned character is an operand,add to the postfix string . 4.If the scanned character is an operator, and if the stack is empty push the character to stack. 5.Repeat 4 steps till the characters are scanned. 6.After all characters are scanned, we have to add any character that the stock may have to the postfix string . 7.If stock is not empty add Top stack to postfix string and pop the stack. 8.Repeat the steps as long as stack is not empty. Conversation Infix to Postfix Ex:- (a+b)*(c-d) in put out put (a+b)*(c-d) (+b)*(c-d)  b*(c-d) *(c-d) *(-d)  *(-) * Empty -  a a+ ab+ ab+c ab+cd ab+cd- ((ab+)(cd-))

Notations For Arthmatic Expression

  Polish notation (or) prefix notation and expressions Converse Polish notation are also known as a prefix notation is defined as in this notation system operator is written before the operands, Example of polish and notations or prefix notations is +AB or /CD.    Based on the operator position ,expressions are divided into three types . They are as follows. Infix expression  Postfix expressions  Prefix expression Infix expression In infix expression ,operators is used in between operands. The general structure of an infix expression is as follows . Operand1 operator Operand2 >>Operators are written in between their operations . >>This is used in our common mathematical expression .   The operators forward of evolution are preformed from left to right and it obeys precedence rules i.e multiplication and division are performed before addition and subtraction.  >>Bracket can be used to change the order of evolution . Ex :- a)A + B b)x*(y+z) c)(a+b) Postfix Notation >

Single dimensional array

Image
Single Dimensional Array A list of items can be given one variable name using only one subscript and such a variable is called a single-subscripted variable or a one dimensional array. Declaration Like any other variable, array must be declared before they are you used. The general form of Array declaration is  Syntax:- Data_type array_name[size of array]; Ex:-int num[10]; >> the data type specifies the type of an element that you will be contained in the array such as int, float ,or char. >>The size indicate the maximum number of elements that can be stored inside the array. >> The size of Array should be constant value. Example:- float ht[20]; ->>declares the height to be an array containing 20 real elements. int group[15]; ->>declares the group as an array to contain a maximum of 15 integers constant . char ch[12]; ->>declares the ch as a character array (string) variable that can hold a maximum of 12 characters. Ex:-int num[10]; Memory allocation

Algorithm Pseudopods Flow-chat

Image
  Algorithm :-      An algorithm is a finite set of instructions (or) logics , written in order to accomplish a certain predefined task it is not the complete code or program which can be expressed either  as an informal high level description as a pseudo code or using a flowchart.   >> From the data structure point of view, following a some important categories of algorithm. >>Search :- algorithm to search an item in a data structure . >>Sort :-algorithm to sort in a certain order >>Insert :-algorithm to insert items in a data structure. >>Update :- algorithm to update an existing items in a data structure. >>Delete :- algorithm to delete an existing item from the data structure. Unambiguous :- Algorithm should be clear and unambiguous. Each of its step (or phase) and their input, output should be e clear must lead to only one meaning. Input :-An algorithm should have 0 or more well-defined inputs >>Output :-An algorithm should have 1 or m

Data structure

Image
  Definition :- Allocating of data elements in Computer memory and retrieving data elements from computer memory is called data structures. How many ways we can organise the data elements in Computer memory.  How many ways we can retrieve in the data elements (called retrieving )from computer memory. Data Structure is a way of collection and organising data in such a way that we can perform operations on this data in an efficient way .So ,that verious operations can be performed on it easily. →Data structure mainly classified into two types.  Linear data structures   Non-linear data structures 1]Linear data structure :- In this element formed in an organised sequence. i.e ,elements are organised in sequential order . Ex:-Array,stock ,queue ,linked list Arrays :- An   array is a data structure that contains a group of elements typically these elements are all of the same datatype . Such as an integer or string array are commonly used in computer programming to organise data. So, that re
Learn SQL with me introduction to SQL SQL stands for "structure query language" and be pronounced as "SQL" OR "SEQUEL". It is a special purpose language used to define , and manipulate data in RDBMS. SQL provides a set of statements for storing and retrieving data to and from a relational data base . The original version called SEQUEL(Structure english query language) was designed by IBM in mid 1970, SQL was first introduce as commercial database system in 1979 by Oracle corporation