正在加载图片...
6.001, Spring Semester, 2005--Quiz I- Sample Solutions Part 4(12 points)Given our little data base of personnel files, we might want to be able to sort the entries, for example by increasing salary. Here is a procedure for sorting (define (find-best best rest compare extractor) (if (null? rest) (if (compare (extractor (car rest)) find-best best (cdr rest) compare extractor))) (define (remove elt rest same) (if (null? rest) (if (same elt (car rest) (cons (car rest) (remove elt (cdr rest) same))))) (define (sort data compare extractor same (let ((trial (find-best (car data) (cdr data) compare extractor))) let ((rest (remove trial data same))) (if (null? rest) rial (cons trial (sort rest compare extractor same))))) For example, to sort our data by increasing salary, we would evaluate (sort sample data< salary We are going to measure the order of growth in time(as measured by the number of primitive operations in the computation) and in space(as measured by the maximum number of deferred operations-do not count in space the intermediate data structures constructed by the algorithm) measured as a function of the size of data, denoted by n. Assume that the procedures used for compare, extractor and same use constant time and space or each of the following questions, choose the description from these options that best describes the order of growth of the process. If you select "something else", please state why C: exponential D: quadra E: logarith somet hing else￾✁✂✂✄☎ ✆✝✞✟✠✡ ✆☛☞☛ ✌✍☛✞ ☎ ✎ ✂✂✏✑✒✓✟✔ ✕ ✖ ✆✗☞✝✘☛ ✆✙✘✓✍✟✙✠✌ ￾ ✚✵✛✻ ￾ ✣✜✤ ✷✺✰✼✻✽✦ ✍✜❈✑✗ ✘✤✔ ✚ ✜✕✕✚✑ ✣✓✕✓ ❋✓✪✑ ✘✙ ✒✑✔✪✘✗✗✑✚ ★✚✑✪✫ ❇✑ ✖✜✢❄✕ ❇✓✗✕ ✕✘ ❋✑ ✓❋✚✑ ✕✘ ✪✘✔✕ ✕❄✑ ✑✗✕✔✜✑✪✫ ✙✘✔ ✑✧✓✖✒✚✑ ❋❉ ✜✗✛✔✑✓✪✜✗✢ ✪✓✚✓✔❉✦ ✆✑✔✑ ✜✪ ✓ ✒✔✘✛✑✣✤✔✑ ✙✘✔ ✪✘✔✕✜✗✢❍ ❁❂❃❄❅❆❃ ❁❄❅❆❂❋◆❃✁☎ ◆❃✁☎ ✄❃✁☎ ✠✟▼☛▲✄❃ ❃✆☎✄▲✠☎✟✄❉ ❁❅❄ ❁❆✆❑❑✁ ✄❃✁☎❉ ◆❃✁☎ ❁❅❄ ❁✠✟▼☛▲✄❃ ❁❃✆☎✄▲✠☎✟✄ ❁✠▲✄ ✄❃✁☎❉❉ ❁❃✆☎✄▲✠☎✟✄ ◆❃✁☎❉❉ ❁❄❅❆❂❋◆❃✁☎ ❁✠▲✄ ✄❃✁☎❉ ❁✠❂✄ ✄❃✁☎❉ ✠✟▼☛▲✄❃ ❃✆☎✄▲✠☎✟✄❉ ❁❄❅❆❂❋◆❃✁☎ ◆❃✁☎ ❁✠❂✄ ✄❃✁☎❉ ✠✟▼☛▲✄❃ ❃✆☎✄▲✠☎✟✄❉❉❉❉ ❁❂❃❄❅❆❃ ❁ ✄❃▼✟✡❃ ❃❑☎ ✄❃✁☎ ✁▲▼❃❉ ❁❅❄ ❁❆✆❑❑✁ ✄❃✁☎❉ ❆❅❑ ❁❅❄ ❁✁▲▼❃ ❃❑☎ ❁✠▲✄ ✄❃✁☎❉❉ ❁✠❂✄ ✄❃✁☎❉ ❁✠✟❆✁ ❁✠▲✄ ✄❃✁☎❉ ❁✄❃▼✟✡❃ ❃❑☎ ❁✠❂✄ ✄❃✁☎❉ ✁▲▼❃❉❉❉❉❉ ❁❂❃❄❅❆❃ ❁ ✁✟✄☎ ❂▲☎▲ ✠✟▼☛▲✄❃ ❃✆☎✄▲✠☎✟✄ ✁▲▼❃❉ ❁❑❃☎ ❁❁☎✄❅▲❑ ❁❄❅❆❂❋◆❃✁☎ ❁ ✠▲✄ ❂▲☎▲❉ ❁ ✠❂✄ ❂▲☎▲❉ ✠✟▼☛▲✄❃ ❃✆☎✄▲✠☎✟✄❉❉❉ ❁❑❃☎ ❁❁✄❃✁☎ ❁ ✄❃▼✟✡❃ ☎✄❅▲❑ ❂▲☎▲ ✁▲▼❃❉❉❉ ❁❅❄ ❁ ❆✆❑❑✁ ✄❃✁☎❉ ❁❑❅✁☎ ☎✄❅▲❑❉ ❁ ✠✟❆✁ ☎✄❅▲❑ ❁ ✁✟✄☎ ✄❃✁☎ ✠✟▼☛▲✄❃ ❃✆☎✄▲✠☎✟✄ ✁▲▼❃❉❉❉❉❉❉ ☞✘✔ ✑✧✓✖✒✚✑✫ ✕✘ ✪✘✔✕ ✘✤✔ ✣✓✕✓ ❋❉ ✜✗✛✔✑✓✪✜✗✢ ✪✓✚✓✔❉✫ ❇✑ ❇✘✤✚✣ ✑❈✓✚✤✓✕✑❍ ❁ ✁✟✄☎ ✁▲▼☛❑❃❂▲☎▲ ✁ ✁▲❑▲✄✁ ✝❉ ◗✑ ✓✔✑ ✢✘✜✗✢ ✕✘ ✖✑✓✪✤✔✑ ✕❄✑ ✘✔✣✑✔ ✘✙ ✢✔✘❇✕❄ ✜✗ ✕✜✖✑ ✩✓✪ ✖✑✓✪✤✔✑✣ ❋❉ ✕❄✑ ✗✤✖❋✑✔ ✘✙ ✒✔✜✖✜✕✜❈✑ ✘✒✑✔✓✕✜✘✗✪ ✜✗ ✕❄✑ ✛✘✖✒✤✕✓✕✜✘✗✬ ✓✗✣ ✜✗ ✪✒✓✛✑ ✩✓✪ ✖✑✓✪✤✔✑✣ ❋❉ ✕❄✑ ✖✓✧✜✖✤✖ ✗✤✖❋✑✔ ✘✙ ✣✑✙✑✔✔✑✣ ✘✒✑✔✓✕✜✘✗✪ ✂ ✣✘ ✗✘✕ ✛✘✤✗✕ ✜✗ ✪✒✓✛✑ ✕❄✑ ✜✗✕✑✔✖✑✣✜✓✕✑ ✣✓✕✓ ✪✕✔✤✛✕✤✔✑✪ ✛✘✗✪✕✔✤✛✕✑✣ ❋❉ ✕❄✑ ✓✚✢✘✔✜✕❄✖✬✫ ✖✑✓✪✤✔✑✣ ✓✪ ✓ ✙✤✗✛✕✜✘✗ ✘✙ ✕❄✑ ✪✜❆✑ ✘✙ ✣✓✕✓✫ ✣✑✗✘✕✑✣ ❋❉ ✸✦ ✂✪✪✤✖✑ ✕❄✓✕ ✕❄✑ ✒✔✘✛✑✣✤✔✑✪ ✤✪✑✣ ✙✘✔ ✵✴✰✭✁✮✳ ✄ ✳☎✱✮✁✵✱✴✮ ✓✗✣ ✂✁✰✳ ✤✪✑ ✛✘✗✪✕✓✗✕ ✕✜✖✑ ✓✗✣ ✪✒✓✛✑✦ ☞✘✔ ✑✓✛❄ ✘✙ ✕❄✑ ✙✘✚✚✘❇✜✗✢ ❅✤✑✪✕✜✘✗✪✫ ✛❄✘✘✪✑ ✕❄✑ ✣✑✪✛✔✜✒✕✜✘✗ ✙✔✘✖ ✕❄✑✪✑ ✘✒✕✜✘✗✪ ✕❄✓✕ ❋✑✪✕ ✣✑✪✛✔✜❋✑✪ ✕❄✑ ✘✔✣✑✔ ✘✙ ✢✔✘❇✕❄ ✘✙ ✕❄✑ ✒✔✘✛✑✪✪✦ ✠ ✙ ❉✘✤ ✪✑✚✑✛✕ ✪ ✪✘✖✑✕❄✜✗✢ ✑✚✪✑✫✫ ✒✚✑✓✪✑ ✪✕✓✕✑ ❇❄❉✦ ✂❍ ✛✘✗✪✕✓✗✕ P❍ ✚ ✜✗✑✓✔ ☎❍ ✑✧✒✘✗✑✗✕✜✓✚ ✏❍ ❅✤✓✣✔✓✕✜✛ ✞❍ ✚✘✢✓✔✜✕❄✖✜✛ ☞❍ ✪✘✖✑✕❄✜✗✢ ✑✚✪✑
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有