"the worst possible values"

This is a discussion on "the worst possible values" within the C Programming forums, part of the General Programming Boards category; Does anyone know what the concept of "the worst possible values" means? I need to create/explain a program in C/Python ...

  1. #1
    Registered User
    Join Date
    Aug 2010
    Posts
    12

    the worst possible values

    Does anyone know what the concept of "the worst possible values" means? I need to create/explain a program in C/Python demonstrating them
    Last edited by n4rush0; 08-22-2010 at 10:55 AM.

  2. #2
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    In the C language? Haven't heard of it.

    Does your particular problem have a "worst possible values" factor to it?

    For instance, if you're program solved the Rubik's Cube, the worst possible values would be values that took the most turns to solve the cube.

  3. #3
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,588
    Yeah, it sounds like the concept of input that results in a worst case performance for an algorithm. Writing the program in C would mainly be a matter of implementing the algorithm, possibly with some code for tracing number of operations, time taken, etc; you would reason out a possible set of input to trigger a worst case scenario and then just run the program with the input, perhaps contrasting the performance with input that results in average and best cases.

    If you can choose the algorithm, one common example would be that of quicksort, where you can contrast O(n**2) worst case with O(n log n) average case.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  4. #4
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,299
    That's what I was thinking also, laserlight.

    Of course the question was wrong in that case, as the thing you'd be looking for is the worst possible ordering (of values).

    The easiest way to demonstrate it is to have a function that constructs a binary search tree (no balancing), and you simply provide the items in sequenctial order. That's a braindead way of doing it though.
    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"

  5. #5
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Quote Originally Posted by Adak View Post
    In the C language? Haven't heard of it.

    Does your particular problem have a "worst possible values" factor to it?

    For instance, if you're program solved the Rubik's Cube, the worst possible values would be values that took the most turns to solve the cube.
    In that case, wouldn't the worst possible values that took the longest to solve the Rubik's Cube be infinite? I'm pretty sure it's possible to keep turning it forever without solving it.
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

  6. #6
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Quote Originally Posted by cpjust View Post
    In that case, wouldn't the worst possible values that took the longest to solve the Rubik's Cube be infinite? I'm pretty sure it's possible to keep turning it forever without solving it.
    Funny!

    The worst possible *starting* configuration values of the Cube.

    More simply, say you had to find the smallest possible value for a signed integer. If you started with an initial value that was the greatest possible value for a signed integer, you would have the worst possible value, for that search.

    It would take you the longest time or most iterations, to find the answer.

  7. #7
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,299
    FYI: They've very recently proved that every possible starting combination of a rubic cube can be solved in 20 moves.
    Given the computing power it required to do so, you won't be working out the worst possible starting point yourself any time soon.
    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"

  8. #8
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    The only way I could solve those damn things was to pull the stickers off and put them where they belong! I never had the patience to sit there for hours turning & twisting it...
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

  9. #9
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    I believe Rubik's Cube solving is like Algebra, Geometry, or lots of other "puzzling" things. You have to work with them for awhile, barely getting any "speed" up, in understanding, at first. After a certain amount of study, the light bulb goes off, and *wham!*, you're on your way at flank speed.

  10. #10
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Quote Originally Posted by Adak View Post
    I believe Rubik's Cube solving is like Algebra, Geometry, or lots of other "puzzling" things. You have to work with them for awhile, barely getting any "speed" up, in understanding, at first. After a certain amount of study, the light bulb goes off, and *wham!*, you're on your way at flank speed.
    Commonly called "Brute force until you get the hang of it"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Games: The best and the worst!
    By CAP in forum A Brief History of Cprogramming.com
    Replies: 73
    Last Post: 10-13-2002, 09:40 PM
  2. worst time to program
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 17
    Last Post: 06-10-2002, 11:32 PM
  3. worst injury
    By dbaryl in forum A Brief History of Cprogramming.com
    Replies: 69
    Last Post: 05-03-2002, 10:03 PM
  4. Whats the worst that could happen?
    By Unregistered in forum C++ Programming
    Replies: 10
    Last Post: 02-18-2002, 07:51 PM
  5. Worst Program Ever.
    By mfc2themax in forum C Programming
    Replies: 11
    Last Post: 10-07-2001, 01:58 PM

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