Chapter 82: Algorithms
Lingtu Daoist put the stones in place, glanced at the audience, and said with a smile: "Poor Dao is different from Zhou Jin, unlike him who likes to stir up teachers and make big scenes, let's just play with these stones." Pen Fun Pavilion www.biquge.info"
There was silence.
Lingtu Dao Chang pointed to the stone and said: "Let's play very simply, there are a total of twelve stones here in the poor road, and they are marked with different numbers, you only need to put these twelve stones, according to the size of the numbers above, from left to right in a row to pass." ”
The audience was in an uproar, and they all thought that Lao Tao was joking.
Seeing that everyone was whispering, but no one stepped forward, Lingtu Dao Master smiled and said, "What? You don't even know such a simple thing?"
"Old Taoist, don't be joking!" a thunderous sound.
Bai Cheng followed the voice, Sima Chaoqun stood up, pointed at the tip of Lao Dao's nose with one hand, and his face was full of anger.
Lingtu Daoist said with a smile: "Poor Dao is not joking, the test is presided over by Lao Dao, and what is tested is naturally Lao Dao's final say." ”
Sima Chaoqun laughed loudly, strode up to the stage, and came to the front of Lao Dao, but after a few efforts, he put the twelve stones in order, laughed and said, "How is it?
Lingtu Dao Chief smiled: "It's passed." ”
There was a boos in the audience, and all the students thought that Lao Dao was just joking, but they didn't expect what he said to be true.
Sima Chaoqun arched his hand and said, "In that case, I'll go first." ”
Lingtu Dao Master smiled slightly and said, "This student is slow, Poor Dao still has a question to ask." ”
Everyone in the audience nodded one after another, but they were afraid that this question was the key, and it was indeed a joke to put stones in front of them.
Sima Chaoqun laughed and said: "I guess that you are not honest as a Taoist priest, if there is any problem, you can say it!"
Lingtu Dao Elder smiled, "How did you arrange these twelve stones?"
Sima Chaoqun was stunned for a moment, and then said: "What kind of method do you want here, the size of the numbers is clear at a glance, and the defecation is arranged in order." ”
Lingtu Dao Master sighed lightly, waved his hand and said, "Poor Dao knows, you can go." ”
Sima Chaoqun didn't say much, turned around and walked out of the palace, and walked away.
Daoist Lingtu smiled at everyone in the audience, took out two stones from this row of stones and swapped places, and shouted, "Next!"
This time it was a tall and thin young man who stood up.
This person walked up to the stage, casually exchanged the two stones that the Lingtu Dao Master had swapped places, and asked, "Dao Chief, can the disciple pass the test?"
Lingtu Dao Chief smiled: "It's passed." ”
The man refused to leave, and then asked, "The disciple heard that the results of the third test are not included in the total score, I wonder if it is true?"
Lingtu Daoist smiled: "Not bad. ”
This person didn't wait for the Lingtu Daoist to ask again, turned around and left, and disappeared in a blink of an eye.
Lingtu Dao Master yawned and picked out two stones again to change positions.
After this person left, it was only half an hour, and the students in the palace left cleanly, and even Li Shenzhou, Liu Wu, Fang Yingkan and others left in a hurry.
In the palace, only Zhao Shirong and Bai Cheng were left.
Daoist Lingtu placed the stones again, reclined to the side, and said, "You two should hurry up and swing them too." ”
Zhao Shirong walked up to the high platform, and said lightly: "That disciple has done it." ”
Lingtu Dao Elder nodded weakly and motioned for her to do it.
Zhao Shirong stretched out his water sleeve with his hand, his fingers were like green onions, and he gently selected the stones, and stacked several stones neatly in the blink of an eye.
Lingtu Dao Chief yawned and said, "Okay, you can go." ”
Zhao Shirong smiled lightly and said, "I haven't said what method to use." ”
Lingtu Daoist perked up and asked, "What method did you use?"
Zhao Shirong said: "This method is also simple, I first choose a stone to put in the middle, and then choose a piece, as long as it is smaller than this one, I will put it in front of it, as long as it is larger than this one, I will put it behind." After the second stone is placed, choose another stone, and so on, it is not difficult to stack these stones. ”
Lingtu Dao's eyes lit up and said, "In addition to this method, what other methods do you have?"
Zhao Shirong thought for a while and said: "Then I will first choose the stone with the largest number and put it on the far right, and then choose the second largest stone to put it in the penultimate position, and so on, it is not difficult to arrange these stones." ”
Lingtu Dao Leader's eyes brightened, he sat up straight and said, "What else can I do, you go on!"
Zhao Shirong smiled lightly and said: "Naturally, there is a way, but the little woman can't say it for a while." ”
Lingtu Dao Chang smiled: "Don't be in a hurry, you just think about it slowly." ”
"You can also compare two adjacent stones, two by two, and exchange them in order from smallest to largest, so that after a trip, the stone with the highest number will be exchanged to the last place, and then start from the beginning, compare and exchange two by two, until the end of the penultimate place, as long as you do this several times, you can shoot the order. Bai Cheng said casually.
Lingtu Daoist was shocked, looked at Bai Cheng under the stage, his two eyes widened, and said, "How can you think of such a method?"
Bai Cheng smiled: "The disciple is just talking casually. ”
Lingtu Dao Leader muttered to himself and said, "What a casual one!"
Zhao Shirong frowned slightly, and after pondering for a moment, he suddenly smiled: "Yes, although this method is a little cumbersome, it can be regarded as ingenious. ”
The Lingtu Dao Leader pondered for a moment, and suddenly asked, "What's your name?"
Bai Cheng smiled slightly and said, "Disciple Bai Cheng." ”
Lingtu Daoist stood up, walked down the high platform quickly, came to Bai Cheng's side and asked, "Is there any way you can arrange the stones?"
Bai Cheng smiled: "There are many ways. For example, find the stone with the lowest number written on it and put it first, then find the stone with the largest number and put it in the last place. Then find the second smallest number and put it in the second place, and then find the second largest number and put it in the penultimate place. And so on until it is done. ”
Lingtu Dao Chang was dumbfounded and said, "Yes, it's also a way." ”
Zhao Shirong's eyes flashed, and he said, "It's faster than the method just now." ”
Lingtu Dao Master grabbed Bai Cheng and shouted, "What else can you do, just say it." ”
Bai Cheng said with a wry smile: "For another example, first divide these twelve stones into two groups, of which the smaller numbers are divided into one group, and the larger numbers are divided into one group, and then this method will sort these two groups of data again, and so on." ”
Lingtu Dao Chief's eyes straightened, stared at Bai Cheng and said, "How did you come up with these methods? Could it be that you have studied this before? That's not right, who else will study this besides the old Dao?"
Bai Cheng secretly said in his heart, he may not be able to test other ways this old way, but this problem of the size of the arrangement is simply easy for him.
When he was on Earth in his previous life, he was very interested in computer programming, and I don't know how many times he has played this kind of algorithm of arranging sizes! )