
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Write a prolog function, average(X,Y), that takes a list (X) of integer values as input and returns
the average of the values of X in variable Y. Assume that the list contains at least one element.
Examples:
average([4,5,51],Y) should return Y=20.
average([4,5],Y) should return Y=4.5.
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 4 steps with 3 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- In kotlin, Write a recursive function with an expression body that takes a list of Pairs in which each value may be of any type, and returns a list of the first elements from each pair.arrow_forwardC programming languagearrow_forwardTheory of computation: Write a program using c++ and pseudo code to check if the entering value following the grammar or not without checking if the grammar is left recursion or not: E ---> E + T | T T---> T * F | F F---> (E) | i Thanks in advance ( I hope you solve it fast with the right answer if you can't solve it leave it please! )arrow_forward
- Discrete Structures Arrange the functions √n (square root of n), 1000log(n), nlog(n), 2n!, 2n, 3n, n2/100000 in increasing order for their Big-O estimate.arrow_forwardpart 1. draw the recursive call tree for the following function when its called with a(7) int a (int n) { if (n % 4== 0) { return n+1;} else { return a(n-1) + a (n*4); } } part 2. what is the returning value?arrow_forwardWrite a recursive function in C++ to multiply all even numbers from 2 to n, where n is an input to the function, and n>=2.arrow_forward
- Let the function fun be defined as: int fun(int &k) { k += 4; return 3 * k -1; } Suppose the function fun was used in a program as follows: void main() { int i = 10, j = 10, sum1, sum2; sum1 = (i / 2) + fun(i); sum2 = fun(j)) + ( j / 2); } A. What are the values of sum1 and sum2 if the operands in the expressions are evaluated left to right? B. What are the values of sum1 and sum2 if the operands in the expressions are evaluated right to left?arrow_forwardI need the answer as soon as possiblearrow_forwardWrite a LISP function f10 that finds the intersection of two lists. The intersection meansthe common elements of the two lists. Example: (f10 ‘(a (a b) c d) ‘(b(a b) d)) returns ((a b) d) CAN ONLY USE CAR AND CDR AND RECURSION SETQ AND DO LIST CANT BE USEDarrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education