This blog is under construction

Saturday, 16 February 2013

Algorithm, Program, Data Structure and Pseudocode


What is an algorithm?

An algorithm is a set of instructions that can be used for solving a problem.  An efficient algorithm is the one that takes less running time and memory.

Algorithm to swap two numbers:
Step 1: Start
Step 2: Input two numbers(val1 and val2)
Step 3: Assign "val1" to a temporary variable (temp)
Step 4: Assign "val2" to  "val1"
Step 5: Assign "temp" to "val2"
Step 6: Display values in val1 & val2


What is a program?

Program is nothing but implementation of an algorthim using any programming language(Eg: C, C++, Java etc)

C program to swap two numbers:
#include<stdio.h>
int main() {
int val1, val2, temp;
printf("Enter two numbers:");
scanf("%d%d", &val1, &val2);
temp = val1;
val1= val2;
val2 = temp;
printf("After swapped: %d  %d\n", val1, va2);
return 0;
}

What is a pseudocode?
It is a combination of both natural and programming language which can be used to explain the generic implementation of an algorithm.

Pseudocode to swap two numbers:
swap(a, b)
t  <- a
a <- b
b <- t
return a, b


What is a data structure?

Organizing, storing and retrieving needed data to solve a problem.
Eg: Arrays, Lists, Stack etc.
char str[5][10] = {"English", "Math", "Physics", "Computer", "Biology"};

See Also:
Data Structure Programs In C

16 comments:

  1. perfect explanation about java programming .its very useful.thanks for your valuable information.java training in chennai | best java training in velachery

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. Nice Blog, The way you have explained about the things is very well and the suggestions are the best.
    Read how to Protect your computer from online hackers.

    ReplyDelete
  4. It would have been the happiest moment for you,I mean if we have been waiting for something to happen and when it happens we forgot all hardwork and wait for getting that happened.
    python training in chennai | python training in bangalore

    python online training | python training in pune

    python training in chennai

    ReplyDelete
  5. I know you feel more happy when you get things done and best of all those things are your most precious treasure.
    java training in chennai | java training in bangalore

    java online training | java training in pune

    java training in chennai | java training in bangalore

    ReplyDelete
  6. Hello I am so delighted I found your blog, I really found you by mistake, while I was looking on Yahoo for something else, anyways I am here now and would just like to say thanks for a tremendous post. Please do keep up the great work.
    Data Science training in marathahalli
    Data Science training in btm
    Data Science training in rajaji nagar
    Data Science training in chennai
    Data Science training in kalyan nagar
    Data Science training in electronic city
    Data Science training in USA



    ReplyDelete
  7. This blog is the general information for the feature. You got a good work for these blog.We have a developing our creative content of this mind.Thank you for this blog. This for very interesting and useful.
    python training in velachery
    python training institute in chennai

    ReplyDelete
  8. I accept there are numerous more pleasurable open doors ahead for people that took a gander at your site.we are providing ReactJs training in Chennai.
    For more details: ReactJs training in chennai

    ReplyDelete
  9. This comment has been removed by the author.

    ReplyDelete
  10. Really nice blog, very infromative. You can refer more topics related to Data Structure like Sorting alorithm, Searching Algorithm and stack linked list from here for future articles
    Thanks !

    ReplyDelete
  11. Really nice blog, very infromative. You can refer more topics related to Data Structure like Sorting alorithm, Searching Algorithm and stack linked list from here for future articles
    Thanks !

    ReplyDelete


  12. Grab the Oracle Training in Chennai from Infycle Technologies the best software training and placement center in Chennai which is providing technical software courses such as Data Science, Artificial Intelligence, Cyber Security, Big Data, Java, Hadoop, Selenium, Android, and iOS Development, DevOps, . etc with 100% hands-on practical training. Call 7504633633 to get a free demo with more info.

    ReplyDelete