Các cấu trúc áp đặt bởi mô đun giúp cho phép có thể dùng lại phần mềm. Nếu các mô-đun phần mềm được viết bằng một cách trừu tượng để giải quyết các vấn đề chung, sau đó mô-đun có thể được tái sử dụng khi trường hợp của những vấn đề chung giống nhau phát sinh trong các bối cảnh khác. | We show an example output from a run of the Duck Duck Goose program in Figure . Figure Sample output from the Duck Duck Goose program. Playing Duck Duck Goose for .Joe Bob Jen Pam Tom Ron Vic Sue. Bob is it. Jen is a duck. Pam is a duck. Tom is a duck. Ron is the goose The goose won Playing Duck Duck Goose for Ron Bob. Vic Sue. Joe Jen Pam Tom Bob is it. Vic is the goose The goose won Playing Duck Duck Goose for .Vic Bob Sue Joe Jen Pam ToftIj Ron. Bob is it. Sue is a duck. Joe is a duck Jen is a duck. Pam is a duck. Tom is a duck. Ron is a duck. Vic is a duck. Sue is the goose The goose Jost Final circle is .Bob Sue. Joe Jen. Pam Tom Ron. Vic. Note that each iteration in this particular execution of this program produces a different outcome due to the different initial configurations and the use of random choices to identify ducks and geese. Likewise whether the Duck or the Goose wins the race is also different depending on random choices. This execution shows a situation where the next child after the it person is immediately identified as the Goose as well a situation where the it person walks all the way around the group of children before identifying the Goose. Such situations also illustrate the usefulness of using a circularly linked list to simulate circular games like Duck Duck Goose. Sorting a Linked List 186 We show in Code Fragment theinsertion-sort algorithm Section for a doubly linked list. A Java implementation is given in Code Fragment . Code Fragment High-level pseudo-code description of insertion-sort on a doubly linked list. Algorithm InsertionSort Input A doubly linked list L of comparable elements Output The list L with clem dlls rearranged in non-deereasing order if - 1 then return 7ỉí white end is not the last node in . do pivot end. get Next 0 Remove pivot from L ins end white ins is not the header and ins s element is greater than pivot s do ins ins. get p reV j Add pivot just after .