Thread: Algorithm Efficiency

  1. #1
    Registered User
    Join Date
    Sep 2002
    Posts
    92

    Algorithm Efficiency

    Hey all,
    I was wondering if anybody knew some good sites about the basic concept of algorithm efficiency? If you do, would you kindly post them? Thank you.

  2. #2
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    I was wondering if anybody knew some good sites about the basic concept of algorithm efficiency?
    The concept is well known. It is often referred to as "common sense"

    Seriously, though, it's just a matter of:
    - refining your code so that it cannot be reduced any further.
    - never calling a function twice if you don't need to.
    - using a few variables as necessary. Care should be taken here, though as to not make your code hard to read, of course...just use common sense.
    -weigh the impact of speed on a choice of an algorithm, and it's relative importance.
    -align variables in classes and structs such to minimize padding.

    In general, if you are aiming for lightning speed, (and I mean where it is necessary, and not just a frivolous desire), then you can comprimise readability to maximize the above.
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  3. #3
    Blank
    Join Date
    Aug 2001
    Posts
    1,034
    It depends on what your coding. It's best
    not to limit yourself to efficiancy but also correctness.
    This has the best online resourses. A few authors have
    put up their lecture notes but your best off getting a book.
    http://www.math.gatech.edu/~cain/tex...linebooks.html

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Implement of a Fast Time Series Evaluation Algorithm
    By BiGreat in forum C Programming
    Replies: 7
    Last Post: 12-04-2007, 02:30 AM
  2. Replies: 4
    Last Post: 12-10-2006, 07:08 PM
  3. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  4. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM