Nothing is Random!

P.S. :- Original author Mark Helprin.

Nothing is random, nor will anything ever be, whether a long string of perfectly blue days that begin and end in golden dimness, the most seemingly chaotic political acts, the rise of a great city, the crystalline structure of a gem that has never seen the light, the distributions of fortune, what time the milkman gets up, the position of the electron, or the occurrence of one astonishingly frigid winter after another.
Even electrons, supposedly the paragons of unpredictability, are tame and obsequious little creatures that rush around at the speed of light, going precisely where they are supposed to go. They make faint whistling sounds that when apprehended in varying combinations are as pleasant as the wind flying through a forest, and they do exactly as they are told. Of this, one can be certain.
And yet there is a wonderful anarchy, in that the milkman chooses when to arise, the rat picks the tunnel into which he will dive when the subway comes rushing down the track from Borough Hall, and the snowflake will fall as it will. How can this be? If nothing is random, and everything is predetermined, how can there be free will? The answer to that is simple.
Nothing is predetermined; it is determined, or was determined, or will be determined. No matter, it all happened at once, in less than an instant, and time was invented because we cannot comprehend in one glance the enormous and detailed canvas that we have been given - so we track it, in linear fashion, piece by piece. Time, however, can be easily overcome; not by chasing light, but by standing back far enough to see it all at once.
The universe is still and complete. Everything that ever was, is; everything that ever will be, is - and so on, in all possible combinations. Though in perceiving it we imagine that it is in motion, and unfinished, it is quite finished and quite astonishingly beautiful.
In the end, or rather, as things really are, any event, no matter how small, is intimately and sensibly tied to all others. All rivers run full to the sea; those who are apart are brought together; the lost ones are redeemed; the dead come back to life; the perfectly blue days that have begun and ended in golden dimness continue, immobile and accessible; and, when all is perceived in such a way as to obviate time, justice becomes apparent not as something that will be, but as something that is.

Learning to Get Back Up

P.S.:- Originally written by Craig B. Larson Adapted from "Illustrations for Preaching & Teaching from Leadership Journal Baker Books

Bringing a giraffe into the world is a tall order. A baby giraffe falls 10 feet from its mother's womb and usually lands on its back. Within seconds it rolls over and tucks its legs under its body. From this position it considers the world for the first time and shakes off the last vestiges of the birthing fluid from its eyes and ears. Then the mother giraffe rudely introduces its offspring to the reality of life.
In his book, A View from the Zoo, Gary Richmond describes how a newborn giraffe learns its first lesson.
The mother giraffe lowers her head long enough to take a quick look. Then she positions herself directly over her calf. She waits for about a minute, and then she does the most unreasonable thing. She swings her long, pendulous leg outward and kicks her baby, so that it is sent sprawling head over heels.
When it doesn't get up, the violent process is repeated over and over again. The struggle to rise is momentous. As the baby calf grows tired, the mother kicks it again to stimulate its efforts. Finally, the calf stands for the first time on its wobbly legs.
Then the mother giraffe does the most remarkable thing. She kicks it off its feet again. Why? She wants it to remember how it got up. In the wild, baby giraffes must be able to get up as quickly as possible to stay with the herd, where there is safety. Lions, hyenas, leopards, and wild hunting dogs all enjoy young giraffes, and they'd get it too, if the mother didn't teach her calf to get up quickly and get with it.
The late Irving Stone understood this. He spent a lifetime studying greatness, writing novelized biographies of such men as Michelangelo, Vincent van Gogh, Sigmund Freud, and Charles Darwin.
Stone was once asked if he had found a thread that runs through the lives of all these exceptional people. He said, "I write about people who sometime in their life have a vision or dream of something that should be accomplished and they go to work.
"They are beaten over the head, knocked down, vilified, and for years they get nowhere. But every time they're knocked down they stand up. You cannot destroy these people. And at the end of their lives they've accomplished some modest part of what they set out to do."

This is how Google works!!!

GOOGLE
With ref. to URL

Google runs on a distributed network of thousands of low-cost computers and can therefore carry out fast parallel processing. Parallel processing is a method of computation in which many calculations can be performed simultaneously, significantly speeding up data processing. Google has three distinct parts:
  • Googlebot, a web crawler that finds and fetches web pages.
  • The indexer that sorts every word on every page and stores the resulting index of words in a huge database.
  • The query processor, which compares your search query to the index and recommends the documents that it considers most relevant.

1. Googlebot, Google’s Web Crawler

Googlebot is Google’s web crawling robot, which finds and retrieves pages on the web and hands them off to the Google indexer. It’s easy to imagine Googlebot as a little spider scurrying across the strands of cyberspace, but in reality Googlebot doesn’t traverse the web at all. It functions much like your web browser, by sending a request to a web server for a web page, downloading the entire page, then handing it off to Google’s indexer.

Googlebot consists of many computers requesting and fetching pages much more quickly than you can with your web browser. In fact, Googlebot can request thousands of different pages simultaneously. To avoid overwhelming web servers, or crowding out requests from human users, Googlebot deliberately makes requests of each individual web server more slowly than it’s capable of doing.

Googlebot finds pages in two ways: through an add URL form, www.google.com/addurl.html, and through finding links by crawling the web.

Unfortunately, spammers figured out how to create automated bots that bombarded the add URL form with millions of URLs pointing to commercial propaganda. Google rejects those URLs submitted through its Add URL form that it suspects are trying to deceive users by employing tactics such as including hidden text or links on a page, stuffing a page with irrelevant words, cloaking (aka bait and switch), using sneaky redirects, creating doorways, domains, or sub-domains with substantially similar content, sending automated queries to Google, and linking to bad neighbors. So now the Add URL form also has a test: it displays some squiggly letters designed to fool automated “letter-guessers”; it asks you to enter the letters you see — something like an eye-chart test to stop spambots.

When Googlebot fetches a page, it culls all the links appearing on the page and adds them to a queue for subsequent crawling. Googlebot tends to encounter little spam because most web authors link only to what they believe are high-quality pages. By harvesting links from every page it encounters, Googlebot can quickly build a list of links that can cover broad reaches of the web. This technique, known as deep crawling, also allows Googlebot to probe deep within individual sites. Because of their massive scale, deep crawls can reach almost every page in the web. Because the web is vast, this can take some time, so some pages may be crawled only once a month.

Although its function is simple, Googlebot must be programmed to handle several challenges. First, since Googlebot sends out simultaneous requests for thousands of pages, the queue of “visit soon” URLs must be constantly examined and compared with URLs already in Google’s index. Duplicates in the queue must be eliminated to prevent Googlebot from fetching the same page again. Googlebot must determine how often to revisit a page. On the one hand, it’s a waste of resources to re-index an unchanged page. On the other hand, Google wants to re-index changed pages to deliver up-to-date results.

To keep the index current, Google continuously recrawls popular frequently changing web pages at a rate roughly proportional to how often the pages change. Such crawls keep an index current and are known as fresh crawls. Newspaper pages are downloaded daily, pages with stock quotes are downloaded much more frequently. Of course, fresh crawls return fewer pages than the deep crawl. The combination of the two types of crawls allows Google to both make efficient use of its resources and keep its index reasonably current.

2. Google’s Indexer

Googlebot gives the indexer the full text of the pages it finds. These pages are stored in Google’s index database. This index is sorted alphabetically by search term, with each index entry storing a list of documents in which the term appears and the location within the text where it occurs. This data structure allows rapid access to documents that contain user query terms.

To improve search performance, Google ignores (doesn’t index) common words called stop words (such as the, is, on, or, of, how, why, as well as certain single digits and single letters). Stop words are so common that they do little to narrow a search, and therefore they can safely be discarded. The indexer also ignores some punctuation and multiple spaces, as well as converting all letters to lowercase, to improve Google’s performance.

3. Google’s Query Processor

The query processor has several parts, including the user interface (search box), the “engine” that evaluates queries and matches them to relevant documents, and the results formatter.

PageRank is Google’s system for ranking web pages. A page with a higher PageRank is deemed more important and is more likely to be listed above a page with a lower PageRank.

Google considers over a hundred factors in computing a PageRank and determining which documents are most relevant to a query, including the popularity of the page, the position and size of the search terms within the page, and the proximity of the search terms to one another on the page. A patent application discusses other factors that Google considers when ranking a page. Visit SEOmoz.org’s report for an interpretation of the concepts and the practical applications contained in Google’s patent application.

Google also applies machine-learning techniques to improve its performance automatically by learning relationships and associations within the stored data. For example, the spelling-correcting system uses such techniques to figure out likely alternative spellings. Google closely guards the formulas it uses to calculate relevance; they’re tweaked to improve quality and performance, and to outwit the latest devious techniques used by spammers.

Indexing the full text of the web allows Google to go beyond simply matching single search terms. Google gives more priority to pages that have search terms near each other and in the same order as the query. Google can also match multi-word phrases and sentences. Since Google indexes HTML code in addition to the text on the page, users can restrict searches on the basis of where query words appear, e.g., in the title, in the URL, in the body, and in links to the page, options offered by Google’s Advanced Search Form and Using Search Operators (Advanced Operators).

Some helpful links:-

GOOGLE First Paper presented by Page n Brin.

Web Crawler Algorithm used by Google n other search engines.

* Page Rank Algorithm used by Google.

Ref. With Chris Sherman and Gary Price’s description.

Famous failures of complex engineering systems

P.S.:- I found this information at Original Location

“To err is human, but to really foul things up you need a computer.”
I am listing some of most famous failures of complex engg. systems.These failures were due partly or primarily to factors beyond engineering or technical considerations, we will concentrate on the technical issues. I haven’t included some of the most dramatic failures, such as Chernobyl, Challenger, or Bhopal, because these involve much more complicated interactions of engineering and human judgment and they’ve received such extensive coverage.
I guess complexity arises from need to provide reliable predictability in the presence of uncertainty, and that failures occur when uncertainties and interactions are not properly accounted for. In retrospect, for all of these failures, we can always identify a component that failed and do simple “back of the envelope” calculations with very simple models to explain the failure. It is essentially always possible to ignore, if we choose, the system design issues that contributed to the failure. A deeper view also always reveals that there were system design flaws and that the apparent component failure was merely a symptom. Of course, the VE(Dynamics, interconnection, and uncertainty management) challenge is to create an environment where we are better at doing that before the failure occurs.

Titanic

On April 14, 1912, the Titanic, the largest, most complex ship afloat, struck an iceberg and sank. The Titanic had a double-bottomed hull that was divided into 16 watertight compartments. Because at least four of these could be flooded without endangering the liner's buoyancy, it was considered unsinkable. Unfortunately, these compartments weren’t sealed off at the top, so water could have just filled each compartment, tilting the ship, and then spilled over the top into the next one. Following recent expeditions to examine the Titanic wreckage and a review of survivor accounts, it is now generally agreed that the iceberg scraped along the starboard side of the ship causing the plates to buckle and burst at the seams and producing several small ruptures in up to six of the first compartments. This is perhaps one of the all-time great failures to correctly modeling the interaction of uncertainty in the environment and the way it can couple with the dynamics of a system. A purely static view of the ship, one that ignored the dynamics of the interaction with the iceberg and the water flow between the compartments, would not have predicted the actual disaster.


Estonia Ferry

It would seem unlikely that a mistake of the type that occurred in the Titanic would be repeated. However, a weak door lock was one of the main reasons for the 1994 Estonia ferry disaster that caused the deaths of more than 800 people. The ferry’s bow visor, a huge top-hinged door at the front of the ferry that swung up to allow vehicles to be driven into and out of the ferry’s car deck was secured by several locks. The lower lock, known as the Atlantic lock, was too weak to withstand extremely heavy pounding by rough seas. Stormy seas in the Baltic Sea on Sept. 28 broke the lock between 30 minutes and one hour before the 157-meter (515-foot) ferry sank shortly after midnight. The noise of the loose bow visor slamming at the hull was heard by several survivors. The slamming set off a chain of events including the breaking of other locks that ended in the tragedy. Only 137 of the more than 900 people on board survived. The commission that investigated the incident said the shipbuilder did not have proper blueprints for the lock when constructing the ferry in 1980. As a result, the commission says the shipbuilder apparently made its own calculations and underestimated how strong the lock should be. This particular failure would seem the one most likely to be caught with an integrated CAD system.

Tacoma Narrows Bridge
The Tacoma Narrows Bridge was the first suspension bridge across the Narrows of Puget Sound, connecting the Olympic Peninsula with the mainland of Washington, and a landmark failure in engineering history. Four months after its opening, on the morning of Nov. 7, 1940, in a wind of about 42 miles (68 km) per hour, the 2,800-foot (853-meter) main span went into a series of torsional oscillations the amplitude of which steadily increased until the convolutions tore several suspenders loose, and the span broke up. The bridge was designed to have acceptable horizontal displacement under the static pressure of a much larger wind, but was not designed to handle the dynamic instability caused by an interaction of the winds and the high degree of flexibility of the light, narrow, two-lane bridge. Modeling this type of fluid/structure interaction, a particularly simple type of flutter, was within the technical capability of engineers at the time, but was evidently not considered. A modern analysis would likely view the fluid/structure flutter as a bifurcation problem, and analyze the nature of the bifurcation as the wind speed increased. Immediately after the accident, numerous investigators were able to create both simple mathematical and scale physical models that exhibited the same failure as the actual bridge, and very simple models were able to predict the wind speed that would cause the collapse.

Subsynchronous resonance in power systems
Series capacitors are often used in AC transmission systems to provide impedance compensation, particularly for long lines with high inductance, at the 60 Hz synchronous transmission frequency. Series capacitors are economical ways to increase load carrying capacity and enhance transient stability, but the capacitors can combine with the line inductance to create oscillators with natural frequencies below 60 Hz. These electrical oscillators can interact with mechanical torsional vibrational modes of the generator turbine shaft, and in some circumstances can cause instabilities that snap the shaft. This happened dramatically at the Mohave Generating Station in Southern Nevada in 1971 when the turbine shaft broke twice before the condition was properly diagnosed. This is a classic example of uncertainty management gone awry. The capacitors were introduced to improve the stability on the electrical side, and reduce the potential vulnerability to electrical side disturbances, but they had the unanticipated effect of destabilizing the mechanical side. The phenomena is now reasonably well understood and is taken very seriously in design of power systems.

Telephone and power system outages
In recent years, there have been an increasing rash of large scale breakdowns of both the telephone and power systems, typically triggered by small events that lead to a cascade of failures that eventually bring down large portions of the network. The high complexity and interconnectedness of these networks is designed to improve their performance and robustness, but can lead to extreme and unexpected sensitivity to small disturbances. In both cases, highly interconnected nationwide networks allow load balancing to be achieved more economically, and the resulting system is, in principle and usually in practice, much more robust to large disturbances or variations in demand. The high degree of connectivity also makes it possible for small failures to propagate and lead to massive outages. The solution to these sensitivities is to add additional complexity in the form of more sophisticated control strategies. Without careful design, this trend to increasing complexity will not improve robustness.

Denver airport baggage handling system
The automated system was supposed to improve baggage handling by using a computer tracking system to direct baggage contained in unmanned carts that run on a track. Originally scheduled for completion in March 1994, the unfinished $234 million project helped postpone opening of the airport until February 1995. The delay reportedly cost the city roughly $1 million per day in operations costs and interest on bond issues, more than the direct cost of the project. Significant mechanical and software problems plagued the automated baggage handling system. In tests of the system, bags were misloaded, were misrouted, or fell out of telecarts, causing the system to jam. The baggage system continued to unload bags even though they were jammed on the conveyor belt, because the photo eye at this location could not detect the pile of bags on the belt and hence could not signal the system to stop. The baggage system also loaded bags into telecarts that were already full. Hence, some bags fell onto the tracks, again causing the telecarts to jam. This problem occurred because the system had lost track of which telecarts were loaded or unloaded during a previous jam. When the system came back on-line, it failed to show that the telecarts were loaded. The timing between the conveyor belts and the moving telecarts was not properly synchronized, causing bags to fall between the conveyor belt and the telecarts. The bags became wedged under the telecarts, which were bumping into each other near the load point.

Ariane 5
The Ariane 5 was not flight tested because there was so much confidence in M&S. The first flight carried $500M of satellites and was destroyed about 40 seconds after lift off. The error which ultimately led to the destruction of the Ariane 5 launcher was clearly identified in the report of the investigating committee: a program segment for converting a floating point number, representing a measurement, to a signed 16 bit integer was executed with an input data value outside the range representable by a signed 16 bit integer. This run time error (out of range, overflow), which arose in both the active and the backup computers at about the same time, was detected and both computers shut themselves down. This resulted in the total loss of attitude control. The Ariane 5 turned uncontrollably and aerodynamic forces broke the vehicle apart. This breakup was detected by an on-board monitor which ignited the explosive charges to destroy the vehicle in the air. The code in question was reused from an earlier vehicle where the measurement would not have become large enough to cause this failure.

It is tempting to simply dismiss this as a software bug that would be eliminated by better software engineering. It is obvious that the programmer should have checked that the measurement was small enough that the conversion could take place, and if it could not, have the control system take some appropriate action rather than simply shut down. In this case the appropriate action would have been to do nothing, because this measurement, ironically, wasn’t even needed after liftoff. This may seem to make it a trivial issue, but the same code did work fine on the Ariane 4, although a control engineer would presumably have preferred it be done differently.

While the “software bug” view has some truth, it is misleading, because the failure was due to dynamics of the Ariane 5 that were different than the Ariane 4. It is the interaction of the software with the uncertainty in the environment and the dynamics of the vehicle that caused the failure. This is not a software issue, but a design flaw at a much deeper level. It is likely the programmers responsible had no idea how to determine if the Ariane 5 had dynamics such that under suitable environmental conditions the measurement would be too large. Presumably, they could have consulted appropriate experts in control and aerodynamics and anticipated the problem, but it wouldn’t have been a computer science issue at all.

Something interesting

20 Famous Software Disasters

Dont get screwed!!!

PROBLEM-1
A helicopter drops two trains, each on a parachute, onto a straight infinite railway line. There is an undefined distance between the two trains. Each faces the same direction, and upon landing, the parachute attached to each train falls to the ground next to the train and detaches. Each train has a microchip that controls its motion. The chips are identical. There is no way for the trains to know where they are. You need to write the code in the chip to make the trains bump into each other. Each line of code takes a single clock cycle to execute.

You can use the following commands (and only these);
MF - moves the train forward
MB - moves the train backward
IF (P) - conditional that’s satisfied if the train is next to a parachute. There is no "then" to this IF statement.
GOTO

PROBLEM-2

Your stair-climbing robot has a very simple low-level API: the "step" function takes no argument and attempts to climb one step as a side effect. Unfortunately, sometimes the attempt fails and the robot clumsily falls one step instead. The "step" function detects what happens and returns a boolean flag: true on success, false on failure. Write a function "step_up" that climbs one step up (by repeating "step" attempts if necessary). Assume that the robot is not already at the top of the stairs, and neither does it ever reach the bottom of the stairs. How small can you make "step_up"? Can you avoid using variables (even immutable ones) and numbers?

PROBLEM-3

You have 5 jars of pills. Each pill weighs 10 gram, except for contaminated pills contained in one jar, where each pill weighs 9 gm.Given a scale, how could you tell which jar had the contaminated pills in just one measurement?

PROBLEM-4

Given a rectangular (cuboidal for the puritans) cake with a rectangular piece removed (any size or orientation), how would you cut the remainder of the cake into two equal halves with one straight cut of a knife ?

PROBLEM-5

Once upon a time there was a tyrant and clever [quite unusual] king who has 2 widow sisters. Actually, they became widowed after he killed their husbands thinking they want to take his throne. Since then, every noble man in the kingdom feared to approach them. Yet, the king wanted them to remarry again. Finally, on one day, he decided that the first man knocking his private room will marry one of them. On that same day, his minister, a wise man, entered the king's private room. Here, the king told him about his plan, but he decided to give his minister another chance. He told him to make a statement; if this statement is false he has to marry the older sister and if the statement is true he has to marry the younger sister. What is the statement that saves the minister from marriage to the king's sisters???

PROBLEM-6
If you had an infinite supply of water and a 5 quart and 3 quart pail, how would you measure exactly 4 quarts?

PROBLEM-7
Give a one-line C expression to test whether a number is a power of 2.

PROBLEM-8

There are 4 women who want to cross a bridge. They all begin on the same side. You have 17 minutes to get all of them across to the other side. It is night. There is one flashlight. A maximum of two people can cross at one time. Any party who crosses, either 1 or 2 people, must have the flashlight with them. The flashlight must be walked back and forth, it cannot be thrown, etc. Each woman walks at a different speed. A pair must walk together at the rate of the slower woman's pace. Woman 1: 1 minute to cross Woman 2: 2 minutes to across Woman 3: 5 minutes to cross Woman 4: 10 minutes to cross For example if Woman 1 and Woman 4 walk across first, 10 minutes have elapsed when they get to the other side of the bridge. If Woman 4
then returns with the flashlight, a total of 20 minutes have passed and you have failed the mission. What is the order required to get all women across in 17 minutes? Now, what's the other way?

PROBLEM-9

If you are in a boat on a lake and you throw out a suitcase, Will the level of water increase in the lake?

PROBLEM-10

Connect nine dots with four lines

o o o

o o o

o o o

PROBLEM-11

You have 2 candles. Every candle lights for 60 minutes. You have to find the way to measure 45 minutes.

PROBLEM-12

A band is going in the street with a constant speed. Someone in the last row has a dog. The dog runs ahead, reaches the front row of the band and gets back to it's owner. The dog's speed was constant
all the way and while it was running the band passed 50 feet. Find the length of the dog's path,if the distance between the front and the rear row of the band is 50 feet.

PROBLEM-13

A man is running across a bridge.When he is 3/8 of the way across, he heard a train coming behind him. If he keeps running he will reach the end of the bridge at the same time with the train. If he turns around and runs back, he will get to the beginning of the bridge at the same time as the train. The man runs at a speed of 5mph. What is the speed of the train?

PROBLEM-14

There are 100 doors in a row that are all initially closed. You make 100 passes by the doors starting with the first door every time. The first time through you visit every door and toggle the door (if the door is closed, you open it, if its open, you close it). The second time you only visit every 2nd door (door #2, #4, #6). the third time, every 3rd door (door #3, #6, #9), etc, until you only visit the 100th door.What is the state of each door after the last pass?

PROBLEM-15
A man has two paper cubes on his desk. Every day he arranges both cubes so that the front faces show the current day of the month. What numbers are required on the faces of the cubes to allow this for all possible days in the calendar?

PROBLEM-16
You have 240 barrels of wine, one of which has been poisoned. After drinking the poisoned wine, one dies within 24 hours. You have 5 slaves whom you are willing to sacrifice in order to determine which barrel contains the poisoned wine. How do you achieve this in 48 hours?

PROBLEM-17
100 prisoners agree on a strategy before playing the following game: One at a time (in some unspecified order), each of the prisoners is taken to a courtyard where there is a line of 100 boxes. The prisoner gets to make choices to open 50 of the boxes. When a box is opened, it reveals the name of a prisoner (the prisoners have distinct names). The names written in the boxes are in 1-to-1 correspondence with the prisoners; that is, each name is found in exactly one box. If after opening 50 boxes, the prisoner has not found his own name, the game is over and all the prisoners lose. But if the prisoner does find the box that contains his name among the 50 boxes he opens, then the prisoner is taken to the other side of the courtyard where he cannot communicate with the others, the boxes are once again closed, and the next prisoner is brought out into the courtyard. If all prisoners make it to the other side of the courtyard, they win.
One possible strategy is for each prisoner to randomly select 50 boxes and open them. This gives the prisoners 1 chance out of 2100 to win--a slim chance, indeed. But the prisoners can do better, using a strategy that for a random configuration of the boxes will give them a larger chance of winning. How good a strategy can you develop?

PROBLEM-18
You have 240 barrels of wine, one of which has been poisoned. After drinking the poisoned wine, one dies within 24 hours. You have 5 slaves whom you are willing to sacrifice in order to determine which barrel contains the poisoned wine. How do you achieve this in 48 hours?

PROBLEM-19
A building has 16 rooms, arranged in a 4x4 grid. There is a door between every pair of adjacent rooms ("adjacent" meaning north, south, west, and east, but no diagonals). Only the room in the northeast corner has a door that leads out of the building.
In the initial configuration, there is one person in each room. The person in the southwest corner is a psycho killer. The psycho killer has the following traits: If he enters a room where there is another person, he immediately kills that person . But he also cannot stand the site of blood, so he will not enter any room where there is a dead person.
As it happened, from that initial configuration, the psycho killer managed to get out of the building after killing all the other 15 people. What path did he take?

PROBLEM-20
A rubber band (well, a rubber string, really) is 10 meters long. There's a worm that starts at one end and crawls toward the other end, at a speed of 1 meter per hour. After each hour that passes, the rubber string is stretched so as to become 1 meter longer than it just was. Will the worm ever reach the other end of the string?


PROBLEM-21
N prisoners get together to decide on a strategy. Then, each prisoner is taken to his own isolated cell. A prison guard goes to a cell and takes its prisoner to a room where there is a switch. The switch can either be up or down. The prisoner is allowed to inspect the state of the switch and then has the option of flicking the switch. The prisoner is then taken back to his cell. The prison guard repeats this process infinitely often, each time choosing fairly among the prisoners. That is, the prison guard will choose each prisoner infinitely often.
At any time, any prisoner can exclaim "Now, every prisoner has been in the room with the switch". If, at that time, the statement is correct, all prisoners are set free; if the statement is not correct, all prisoners are immediately executed. What strategy should the prisoners use to ensure their eventual freedom?
(Just in case there's any confusion: The initial state of the switch is unknown to the prisoners. The state of the switch is changed only by the prisoners.)
As a warm-up, you may consider the same problem but with a known initial state of the switch.



Problem -22

You are standing in a school hallway lined with 100 closed lockers. You then open all 100 lockers. After this, you then close every 2nd locker (so the 2nd, 4th, 6th…98th and 100th are all closed). Then, you go to every third locker and open it if it is closed or close it if it is open (let’s call this toggling the locker for our discussion). You proceed to toggle every nth locker on pass number n. So, for example, on pass number 16 – you will toggle every 16th locker. After your hundredth pass of the hallway, in which you toggle only locker number 100, how many lockers are now open? In a hall with x lockers, how many lockers remain open after pass number x?


Problem -23

You have someone working for you for seven days and you have one gold bar to pay them. The gold bar is segmented into seven connected pieces. You must give them a piece of gold at the end of every day. If you are only allowed to make two breaks in the gold bar, how do you pay your worker?

Problem-24

You have 5 jars of pills. Each pill weighs 10 grams, except for contaminated pills contained in one jar, where each pill weighs 9 grams. Given a scale, how could you tell which jar had the contaminated pills in just one measurement?

Problem-25

You are given two 60 minute long fuse ropes (i.e. the kind that you would find on the end of a bomb) and a lighter. The fuses do not necessarily burn at a fixed rate. For example, given an 8 foot rope, it may take 5 minutes for the first 4 feet of the fuse to burn, while the last 4 feet could take 55 minutes to burn (a much slower rate) (5+55=60 minutes). Using these two fuses and the lighter, how can you determine 45 minutes? HINT: You can use the lighter any number of times

Problem-26

One train leaves Los Angeles at 15 MPH heading for New York . Another train leaves from New York at 20mph heading for Los Angeleson the same track. If a bird, flying at 25mph, leaves from Los Angeles at the same time as the train and flies back and forth between the two trains until they collide, how far will the bird have traveled?

Problem-27

You have a birthday cake and have exactly 3 cuts to cut it into 8 equal pieces. How do you do it?


Problem-28

Let’s say that you have 25 horses, and you want to pick the fastest 3 horses out of those 25. In each race, only 5 horses can run at the same time. What is the minimum number of races required to find the 3 fastest horses without using a stopwatch?