Tuesday, 27 September 2016

DE presentations

https://drive.google.com/file/d/0BwOGUimc8FQyQVhkdVVMSUs4ZTA/view?usp=sharing



https://drive.google.com/file/d/0BwOGUimc8FQySmxmWjhVRGI0dDQ/view?usp=sharing

Monday, 26 September 2016

de assignment1 solutions

https://drive.google.com/file/d/0BwOGUimc8FQydUp2aUZzbHc1Y3c/view?usp=sharing

Sunday, 25 September 2016

DS experiment 11

algorithm to add an element
1. Start
2. Set J=N
3. Set N = N+1
4. Repeat steps 5 and 6 while J >= K
5. Set LA[J+1] = LA[J]
6. Set J = J-1
7. Set LA[K] = ITEM
8. Stop
 
program 
 

#include<iostream.h>
#include<conio.h>

 void main()
  {
  int i,a[5],no,pos;
  clrscr();
  cout<<"Enter data in Array: ";
  for(i=0;i<5;i++)
  {
  cin>>a[i];
  }
  cout<<"\n\nStored Data in Array: ";
  for(i=0;i<5;i++)
  {
  cout<<a[i];
  }
  cout<<"\n\nEnter position to insert number: ";
  cin>>pos;
  if(pos>5)
  {
  cout<<"\n\nThis is out of range";
  }
  else
  {
  cout<<"\n\nEnter new number: ";
  cin>>no;
  --pos;
  for(i=5;i>=pos;i--)
  {
  a[i+1]=a[i];
  }
  a[pos]=no;
  cout<<"\n\nNew data in Array: ";
  for(i=0;i<6;i++)
  {
  cout<<a[i];
  }
  }
  getch();
  } 

 
algorithm to delete an element 
1. Start
2. Set J=K
3. Repeat steps 4 and 5 while J < N
4. Set LA[J-1] = LA[J]
5. Set J = J+1
6. Set N = N-1
7. Stop 
 
program

#include<iostream.h>
#include<conio.h>

void main()
  {
   int i,a[5],no,pos;
   clrscr();
   cout<<"Enter data in array: ";
   for(i=0;i<5;i++)
   {
    cin>>a[i];
   }
   cout<<"\n\nStored Data in array:  ";
   for(i=0;i<5;i++)
   {
    cout<<a[i];
   }
   cout<<"\n\nEnter poss. of element to delete: ";
   cin>>pos;
   if(pos>5)
   {
   cout<<"\n\nThis value is out of range: ";
   }
   else
   {
   --pos;
   for(i=pos;i<=4;i++)
   {
    a[i]=a[i+1];
   }
   cout<<"\n\nNew data in array: ";
   for(i=0;i<4;i++)
   {
    cout<<a[i];
  }
  }
   getch();
 }
 
 

algorithm to search an element
1. Start
2. Set J=0
3. Repeat steps 4 and 5 while J < N
4. IF LA[J] is equal ITEM THEN GOTO STEP 6
5. Set J = J +1
6. PRINT J, ITEM
7. Stop
 
flowchart
FlowChart_Search_List 

program
 #include<iostream.h>
 #include<conio.h>

 int linear_search(int [],int,int);

 main()
    {
       clrscr();

       constint array_size=10;
       int array[array_size]={0};

       cout<<"\n Enter the contents of the array are : "<<endl;

       cout<<"\n     Elements :"<<"\t\t     Value:"<<endl;

       for(int count=0;count<array_size;count++)
      {
         cout<<"\t"<<" array ["<<count<<"]"<<"\t\t";
         cin>>array[count];
      }

       int searching_element=0;
       int flag=0;

       cout<<"\n\n Enter the element you want to find  =  ";
       cin>>searching_element;

       flag=linear_search(array,array_size,searching_element);

       if(flag!=-1)
      cout<<"\n The given element is found at the position  array["<<
                            flag<<"]"<<endl;

       else
      cout<<"\n The given element is not found. "<<endl;

       getch();
       return 0;
    }

 /*************************************************************************///--------------------  linear_search(int [],int,int)  ------------------///*************************************************************************/int linear_search(int array[],int size,int element)
    {
       for(int count=0;count<size;count++)
      {
         if(element==array[count])
        {
           return count;
        }
      }

       return -1;
    }

de lab manual (complete)

http://gyan.fragnel.ac.in/lm/sem3/dlda.pdf

Tuesday, 20 September 2016

DE assignment-1

https://drive.google.com/file/d/0BwOGUimc8FQyVHFjT1RhdUpSUVE/view?usp=sharing

Monday, 19 September 2016

DE PRACTICAL-3 GRP 2

PDF FILE

https://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwitzbe7v5vPAhXB4D4KHd13CWsQFggeMAA&url=http%3A%2F%2Fwww.iium.edu.my%2Fece%2Flaboratory%2Fdld_microp%2FExperiment_2.pdf&usg=AFQjCNFDIaBXsf6sHN2Bcej21AozIj-rsQ&sig2=Dx4SVAO4FT9TnCjn4ZCD4w

DS-LAB(SWAPPING TWO NO.S)EXPERIMENT-10

ALGORITHM

START

   Var1, Var2, Temp
   
   Step 1 → Copy value of Var1 to Temp
   
   Step 2 → Copy value of Var2 to Var1
          
   Step 3 → Copy value of Temp to Var2

STOP
FLOWCHART:
Image result for FLOWCHART of swapping two numbers
PROGRAM:
#include <iostream>
using namespace std;

int main() {
    
    int a = 5, b = 10, temp;
    cout << "Before swapping." << endl;
    cout << "a = " << a << ", b = " << b << endl;

    temp = a;
    a = b;
    b = temp;

    cout << "\nAfter swapping." << endl;
    cout << "a = " << a << ", b = " << b << endl;


    return 0;
}

DS-LAB(AREA OF TRAINGLE)-EXPERIMENT-9

Algorithm: 

INPUT a, b, c 
s = (a + b + c) / 2 
area = sqrt(s(s-a)(s-b)(s-c)) 
PRINT area 
END 

FLOWCHART:

Image result for flowchart for area of triangle

PROG:

#include<iostream.h>
#include<conio.h>
#include<math.h>

int main()
{
 float a,b,c,s,Area;
 cout<<"Enter three sides of triangle : ";
 cin>>a>>b>>c;
 s=(a+b+c)/2;
 Area=sqrt(s*(s-a)*(s-b)*(s-c));
 cout<<"Area of triangle is : "<<Area;
 getch();
 return 0;
}

DS-LAB(PALINDROME_STRING)-EXPERIMENT-8

Detailed Algorithm:
Step 1:  Input S (string)
Step 2:  Len = 0 , Flag =0
Step 3:  While (S[Len] != NULL)
                        Len++
Step 4:  I = 0 , J = Len-1
Step 5:  While ( I < (Len/2)+1 )
                        If ( S[I] == S[J] )
                                 Flag=0
                        else
                                  Flag=1
                        I++ , J–
Step 6:      If ( Flag == 0 )
                               Print Key Is a Palindrome
                     else
                                Print Key Is Not a Palindrome
Step 7: End
 Flowchart:-
FlowChart_Palindrome

PROG

#include<iostream> using namespace std; int main(){ char string1[20]; int i, length; int flag = 0; cout << "Enter a string: "; cin >> string1; length = strlen(string1); for(i=0;i < length ;i++){ if(string1[i] != string1[length-i-1]){ flag = 1; break; } } if (flag) { cout << string1 << " is not a palindrome" << endl; } else { cout << string1 << " is a palindrome" << endl; } system("pause"); return 0; }

DS-LAB(ARMSTRONG NUMBER)-EXPERIMENT-7

ALGORITHM TO CHECK ARMSTRONG NUMBER

CHECK ARMSTRONG (N)Let N be a three digit Integer. This algorithm checks that whether N is an Armstrong Number or not.
Step 1: Start
Step 2: Take Input N as Integer
Step 3: [ initializing SUM ] Set: SUM = 0
Step 4: Set: Number = N
Step 5: Repeat While Number ≠ 0
SUM = (Number%10)**3 + SUM
Number = Number/10
[ End of While Loop ]
Step 6: [ Checking ? ]
If SUM == N then
Print: N is an Armstrong Number.
Else
Print: N is not an Armstrong Number.
[End of If-Else Structure]
Step 7: Exit

FLOWCHART TO CHECK ARMSTRONG NUMBER


FLOWCHART TO CHECK ARMSTRONG NUMBER

Source Code to Check Armstrong Number

/* C++ program to check whether a number entered by user is Armstrong or not. */

#include <iostream>
using namespace std;
int main()
{
  int n, n1, rem, num=0;
  cout << "Enter a positive  integer: ";
  cin >> n;
  n1=n;
  while(n1!=0)
  {
      rem=n1%10;
      num+=rem*rem*rem;
      n1/=10;
  }
  if(num==n)
    cout << n << " is an Armstrong number.";
  else
    cout << n << " is not an Armstrong number.";
  return 0;
}


DS-LAB(TABLE FO A NO.)EXPERIMENT-6

ALGORITHM

multi_table()
step1:start
step2:intilize y<-x i="" p="">step3:check whether i<= n,then go to step 4
else go to step 8
step4:print x,i,y
step5:y=y+x
step6:i=i+1
step7:go to step 3
step8:stop
main()
step1:start
step2:read num,limit
step3:call multi_table(num,limit)
step4:stop


FLOWCHART
Image result for flowchart to print multiplication table

PROG

Source Code to Display Multiplication table up to 10

#include <iostream>
using namespace std;

int main() {
    int n;
    cout << "Enter an integer: ";
    cin >> n;
    for (int i = 1; i <= 10; ++i) {
        cout << n << " * " << i << " = " << n*i << endl;
    }
    
    return 0;
}