Does anyone know what the concept of "the worst possible values" means? I need to create/explain a program in C/Python demonstrating them
Printable View
Does anyone know what the concept of "the worst possible values" means? I need to create/explain a program in C/Python demonstrating them
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.
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.
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.
Funny! :p
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.
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.
The only way I could solve those damn things was to pull the stickers off and put them where they belong! :D I never had the patience to sit there for hours turning & twisting it...
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.