Try to draw the internal representation of a Lisp list. For example: (A (B (C D) E F(GH)))
Try to draw the internal representation of a Lisp list. For example: (A (B (C D)...
Draw a diagram showing the internal representation of the following LISP list: ( (A B) ((C) D) )
2- Draw the internal representation for the following lisp list(s). You may draw your answer on a paper, scan or picture of it, and paste here. A. (CONS '() (Red)) B. (CONS 'Red '(() Blue)) C. (CONS '(Red Blue) '(Green Yellow Orange)) 3- Consider the following list and answer the following questions ( you must show your works) Initial List for (Red (Blue Green) Black (Yellow (while orange))) each problem 1 CDR 2 CDDR 3 CDDDR 4 CADDR 5 CDADR...
2. Write a LISP function COUNTLETS which takes a list and returns the number of top-level alphabetic atoms in the list. For example: COUNTLETS ( (A 2) B 3 C4 (D 5))) Returns the value 2, the letters A and D are not at the top level
File Edit Format View Help Graphs and trees 4. [6 marks] Using the following graph representation (G(V,E,w)): v a,b,c,d,e,f E fa,b), (a,f),fa,d), (b,e), (b,d), (c,f),(c,d),(d,e),d,f)) W(a,b) 4,W(a,f) 9,W(a,d) 10 W(b,e) 12,W(b,d) 7,W(c,d) 3 a) Draw the graph including weights. b) Given the following algorithm for Inding a minimum spanning tree for a graph: Given a graph (G(V,E)) create a new graph (F) with nodes (V) and no edges Add all the edges (E) to a set S and order them...
Please help with all four questions regarding LISP Programming. Thank you. Please answer all questions with output plesase. LISP Programming Assignment It is a good idea to start this assignment early; Lisp programming, while not inherently difficult, often seem somewhat foreign at first, particularly when it comes to recursion and list manipulation. This assignment is loosely based on material by Dr. Henri Casanova. Problem #1 Define a function that takes two arguments and returns the greater of the two. Problem...
Lisp program count-of (symbol list): Write a function named count-of that takes two parameters, a symbol and a list. Count the number of instances of x in the list. Do not count the number of x in any sub-lists within the list. Test: count-of 'a '(a 'a(a c) d c a). Result: 2 trim-to (symbol list): Write a function named trim-to that takes a symbol and list as parameters. Return a new list starting from the first occurrence of the...
11. Consider molecular formula C3H14 and draw (a) terminal alkyne (b) symmetric internal alkyne (d) conjugated diene (e) isolated diene (C) asymmetric internal alkyne (f) cumulative diene.
Based on the following adjacency list representation of a graph (where there are no weights assigned to the edges), in which order are the elements of this graph accessed during a BFS traversal starting at node A and DFS traversal starting at node E? A: B, C, D B: A, C, D C: A, B, D D: A, B, C, F E: F, G, H F: D, E, G G: E, F, H H: E, G When doing the traversal,...
In Lisp 2. Code the function (replaceIn list possibleList repValue) which constructs a new list. It examines list for occurrences of any of the atoms from the possibleList. Those are replaced with repValue. This only examines the top-level items in list. Example: > (replaceIn '(P A T T E R) '(T R) 'S) (P A S S E S) 3. Code the function (insertAfter list atm insValue) which constructs a new list by inserting the specified insValue into the list...
Explain ur working 4. [6 marks] Using the following graph representation (G(VE,w)): V a, b,c, d,e, fh E -la, b, [a, fl,la,d, (b,ej, [b,d, c,fl,fc,d],Id,el, sd, f) W(a, b) 4, W(a, f)-9, W(a, d)-10 W(b, e) 12, W (b, d)7, W(c,d) 3 a) [3 marks] Draw the graph including weights. b) [2 + 1-3 marks] Given the following algorithm for finding a minimum spanning tree for a graph: Given a graph (G(V,E)) create a new graph (F) vith nodes (V)...