Like Tree1Likes
  • 1 Post By Adak

What is the difference between one Algorithm and one Implementation

This is a discussion on What is the difference between one Algorithm and one Implementation within the C Programming forums, part of the General Programming Boards category; Hello everyone ! I am thinking about the general concept of one ALgorithm. Does exist real separation between algorithm and ...

  1. #1
    Registered User
    Join Date
    Sep 2011
    Location
    Athens , Greece
    Posts
    296

    What is the difference between one Algorithm and one Implementation

    Hello everyone ! I am thinking about the general concept of one ALgorithm.

    Does exist real separation between algorithm and code in C (which is an implementation of algorithm)???

    We can call one program as algorithm? Or only as "Implementation in C of C algorithm"

    For Instance , We assume that we have the simple algorithm (comparison of 2 integers) :

    Figure A (Algorithm in Pseudo-Code):

    if a is higher from b

    Put higher=a;

    otherwise

    if a is less from b

    Put higher=b;

    Figure B ( Implementation in C ) :

    Code:
     
    
    ...
    
    if(a>b)
    higher=a;
    else
    higher=b;
    
    printf("%d",higher);
    Now... We can call A as "basic algorithm" and B as "implementation in C of this algorithm" or also we can call B as algorithm in C? or (both of them? Implementation and algorithm????)

    thank you in advance
    Last edited by Mr.Lnx; 10-08-2011 at 02:37 PM.

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    No, C does not know how to run pseudo-code. C is C... thus you need to write your "code" in C syntax.

  3. #3
    Registered User
    Join Date
    Sep 2011
    Location
    Athens , Greece
    Posts
    296
    Therefore algorithm is algorithm and C implementation of this algorithm is C implementation?

    Can we call a C programm(code) as C algorithm???
    Or Algorithm is Algorithm and when we use this concept
    we actually mean the pseudo-code and not C or php or Python implementation????
    This is what I am asking...

    I understand that my question is not actually clear but I am trying to do clear....

    Thank in advance

    Mr. Lnx

  4. #4
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    An algorithm is the set of steps you take to solve a problem, and C is a programming language. An algorithm is separate from any language, and can be expressed and implemented, in many different ways, including paper and pencil.
    CommonTater likes this.

  5. #5
    Registered User
    Join Date
    Sep 2011
    Location
    Athens , Greece
    Posts
    296
    Quote Originally Posted by Adak View Post
    An algorithm is the set of steps you take to solve a problem, and C is a programming language. An algorithm is separate from any language, and can be expressed and implemented, in many different ways, including paper and pencil.
    Hence , the summary is :

    An algorithm is language independent unlike a computer program???

    Thank you for your time.

    Mr. Lnx

  6. #6
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    as Adak points out... an algorythm is the plan from which you write your program.

  7. #7
    Registered User
    Join Date
    Sep 2011
    Location
    Athens , Greece
    Posts
    296
    Quote Originally Posted by CommonTater View Post
    as Adak points out... an algorythm is the plan from which you write your program.
    HMMMM Adak tolds me that an algorithm is different from any language and it can be expressed and implemented with many different ways. So it depends on a syntax of language (everytime) due to this difference it can be expressed and implemented in different ways .
    Am I right???

    I read here some very interesting and exact opinions and I want to summarize in my notebook these as a finally results.

    Thank you

    Mr. Lnx

  8. #8
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,300
    Quote Originally Posted by Mr.Lnx View Post
    Hence , the summary is :

    An algorithm is language independent unlike a computer program???
    An algorithm is everything independent. It is the process itself, pretty much an intangible thing.
    Even pseudocode is really just a description or representation of an algorithm, typically not being able to be executed by machines in that form.
    An implementation refers to one of potentially an unlimited number of possible representations of the algorithm, that can be executed by a computer.
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

  9. #9
    Registered User
    Join Date
    Sep 2011
    Location
    Athens , Greece
    Posts
    296
    Quote Originally Posted by iMalc View Post
    An algorithm is everything independent. It is the process itself, pretty much an intangible thing.
    Even pseudocode is really just a description or representation of an algorithm, typically not being able to be executed by machines in that form.
    An implementation refers to one of potentially an unlimited number of possible representations of the algorithm, that can be executed by a computer.
    Ok I get it!

    Perfect definition , thank you!

    thank all of you

    Because with the combination of your answers I understood this basic concept of general programming

    Mr. Lnx
    Last edited by Mr.Lnx; 10-09-2011 at 08:51 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Simple Question
    By givmefive5 in forum C Programming
    Replies: 4
    Last Post: 06-23-2011, 05:35 AM
  2. Simple question
    By PPeter in forum C Programming
    Replies: 3
    Last Post: 06-21-2011, 09:04 PM
  3. Theoritical question in trees structures
    By nomikos in forum C Programming
    Replies: 5
    Last Post: 12-20-2010, 10:00 AM
  4. simple simple design question
    By Chaplin27 in forum C++ Programming
    Replies: 6
    Last Post: 05-31-2005, 11:33 PM
  5. A theoritical Qustion
    By ihsir in forum C++ Programming
    Replies: 5
    Last Post: 03-25-2002, 10:47 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21