1. A search tree can be represented in LISP as follows: (a) if the search tree...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
1. A search tree can be represented in LISP as follows: (a) if the search tree contains a single leaf node L, it can be represented by atom L (b) if the search tree has more than one node and is rooted at N, then it can be represented by a list (S1 S2... Sk) where Si represents the ith subtree of N. Consider for example the following search trees, whose LISP representations are shown later. 0 /\ OTRO 0 LE /*/*/* /\ OF Io /\ /\ HT i /1 o C To E AO /\ | A o D | B /I\ H R E /\ o B /\ Co OD I E Write a single LISP function, called BFS. It takes a single argument FRINGE that represents a list of search trees, and returns a top-level list of leaf nodes, in the order they are visited by left-to-right breadth-first search. The inital call to BFS passes a FRINGE list with a single element: the root of the search tree. Test your program on at least these inputs: > (BFS (ROOT)) (ROOT) 1 > (BFS '((((LE) F) T))) (T F L E) > (BFS '((R (I (G (H T}}}}}} (RIGHT) > (BFS '(((A (B)) C (D}}}} (C A D B) > (BFS '((T (HR E) E))) (TEHRE) > (BFS ((A (CC ((E) D)) B}}}} 3 (A B C D E) 1 1. A search tree can be represented in LISP as follows: (a) if the search tree contains a single leaf node L, it can be represented by atom L (b) if the search tree has more than one node and is rooted at N, then it can be represented by a list (S1 S2... Sk) where Si represents the ith subtree of N. Consider for example the following search trees, whose LISP representations are shown later. 0 /\ OTRO 0 LE /*/*/* /\ OF Io /\ /\ HT i /1 o C To E AO /\ | A o D | B /I\ H R E /\ o B /\ Co OD I E Write a single LISP function, called BFS. It takes a single argument FRINGE that represents a list of search trees, and returns a top-level list of leaf nodes, in the order they are visited by left-to-right breadth-first search. The inital call to BFS passes a FRINGE list with a single element: the root of the search tree. Test your program on at least these inputs: > (BFS (ROOT)) (ROOT) 1 > (BFS '((((LE) F) T))) (T F L E) > (BFS '((R (I (G (H T}}}}}} (RIGHT) > (BFS '(((A (B)) C (D}}}} (C A D B) > (BFS '((T (HR E) E))) (TEHRE) > (BFS ((A (CC ((E) D)) B}}}} 3 (A B C D E) 1 1. A search tree can be represented in LISP as follows: (a) if the search tree contains a single leaf node L, it can be represented by atom L (b) if the search tree has more than one node and is rooted at N, then it can be represented by a list (S1 S2... Sk) where Si represents the ith subtree of N. Consider for example the following search trees, whose LISP representations are shown later. 0 /\ OTRO 0 LE /*/*/* /\ OF Io /\ /\ HT i /1 o C To E AO /\ | A o D | B /I\ H R E /\ o B /\ Co OD I E Write a single LISP function, called BFS. It takes a single argument FRINGE that represents a list of search trees, and returns a top-level list of leaf nodes, in the order they are visited by left-to-right breadth-first search. The inital call to BFS passes a FRINGE list with a single element: the root of the search tree. Test your program on at least these inputs: > (BFS (ROOT)) (ROOT) 1 > (BFS '((((LE) F) T))) (T F L E) > (BFS '((R (I (G (H T}}}}}} (RIGHT) > (BFS '(((A (B)) C (D}}}} (C A D B) > (BFS '((T (HR E) E))) (TEHRE) > (BFS ((A (CC ((E) D)) B}}}} 3 (A B C D E) 1 1. A search tree can be represented in LISP as follows: (a) if the search tree contains a single leaf node L, it can be represented by atom L (b) if the search tree has more than one node and is rooted at N, then it can be represented by a list (S1 S2... Sk) where Si represents the ith subtree of N. Consider for example the following search trees, whose LISP representations are shown later. 0 /\ OTRO 0 LE /*/*/* /\ OF Io /\ /\ HT i /1 o C To E AO /\ | A o D | B /I\ H R E /\ o B /\ Co OD I E Write a single LISP function, called BFS. It takes a single argument FRINGE that represents a list of search trees, and returns a top-level list of leaf nodes, in the order they are visited by left-to-right breadth-first search. The inital call to BFS passes a FRINGE list with a single element: the root of the search tree. Test your program on at least these inputs: > (BFS (ROOT)) (ROOT) 1 > (BFS '((((LE) F) T))) (T F L E) > (BFS '((R (I (G (H T}}}}}} (RIGHT) > (BFS '(((A (B)) C (D}}}} (C A D B) > (BFS '((T (HR E) E))) (TEHRE) > (BFS ((A (CC ((E) D)) B}}}} 3 (A B C D E) 1
Expert Answer:
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
A public golf course has about 100 golfers per day and charges each golfer $15 to play. The golf course owner predicts that there will be 10 more golfers each day for every $1 reduction in the price...
-
List three specific parts of the Case Guide, Objectives and Strategy Section (See below) that you had the most difficulty understanding. Describe your current understanding of these parts. Provide...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-5. Ivan's grandfather died and left a portfolio of municipal bonds. In 2012, they pay Ivan...
-
Question 1 Not yet answered Paints out of 1.00 P Flag question Question 2 Not yet answered Paints out of 1.00 P Flag question A project has the following activities, with specified precedents and...
-
A fiber optic cable is suspended over the poles so that the angle at the supports is . Determine the minimum tension in the cable and the sag. The cable has a mass density and the supports are at...
-
Your investment company has been approached about investing in an elite junior volleyball club. The team owners are in need of additional funding to renovate their current facility and make it more...
-
Consider the hypotheses for the general linear model, which are of the form \[H_{0}: \mathbf{T} \beta=\mathbf{c}, \quad H_{1}: \mathbf{T} \beta eq \mathbf{c}\] where $\mathbf{T}$ is a $q \times p$...
-
An off-duty, out-of-uniform police officer and his son purchased some food from a 7- Eleven store and were still in the parking lot when a carload of teenagers became rowdy. The officer went to speak...
-
9. By finding the x and y intercepts, graph each of the following. II) 5. y = x + 2 7. 8x-4y = 16 III) 3x+y=2 x intercept = y intercept = x intercept = y intercept = 6. 4x+5y=20 8. y-4x=8 Write in...
-
John Sullivan started a business. During the first month (February 20--), the following transactions occurred. Show the effect of each transaction on the accounting equation: Assets = Liabilities +...
-
Gonzales Brush Company sells standard hair brushes. The following information summarizes Gonzales's operating activities for 2018: (Click the icon to view the information.) Requirements 1. Calculate...
-
What type of sampling procedure and sampling technique will be used to access the appropriate sample? Develop a hypothetical research scenario that would necessitate the use of a Predictive Design....
-
Discuss the sampling strategy and technique to be used. Develop a hypothetical research scenario that would necessitate the use of the Qualitative Method and the Grounded Theory Perspective. The...
-
How will these threats be addressed in accordance, based on the discussion of the control techniques in the previous question? Develop a hypothetical research scenario that would necessitate the use...
-
Develop the appropriate primary research question to be associated with this design. Develop a hypothetical research scenario that would necessitate the use of the Qualitative Method and the Grounded...
-
What type of sampling procedure and sampling technique will be used to access the appropriate sample? Develop a hypothetical research scenario that would necessitate the use of a Longitudinal Design....
-
Bryan's goal is to expand the number of clients in his computer consulting business by 8.5% next year. If Bryan currently has 62 clients, how many clients will he need to have altogether next year to...
-
How much more interest will be earned if $5000 is invested for 6 years at 7% compounded continuously, instead of at 7% compounded quarterly?
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1 and 2. On September 1, Irene opened a retail store that specializes in sports car...
-
Larry and Lisa Williams, both 33 years old, have been married for 9 years. They live at 638 Arctic Way, Fairbanks, AK 99701. Lisa's Social Security number is 445- 81-1423 and Larry's is 798-09-8526....
-
Mike purchases a heavy-duty truck (5-year class recovery property) for his delivery service on April 30, 2012. The truck is not considered a passenger automobile for purposes of the listed property...
-
There is another possible explanation for purchased goodwill appearing in a sole proprietor's statement of financial position. What do you think it might be?
-
Why do the assets need to be revalued in these cases? The business has not been sold.
-
The shown partners have always shared profits and losses in the ratio: Holt 4; Stott 2: Young 1. From 1 January the assets were to be revalued as the profit sharing ratios are to be altered soon. The...
Study smarter with the SolutionInn App