How to calculate median of a list of numbers in Scheme (Lisp)?

1 Answer

Answer :

answer:I don’t know Scheme at all. Logically I’d say; Sort the list. If the number of items is odd, the median will be in the middle position. (middle position for an odd number would be ((NumInList – 1 ) / 2 ) + 1 for an even number the median is the two middle positions averaged together. Something like : sort list. if (numInList odd) >> median =( ( numInList -1 ) / 2 ) + 1 else ( numList even) >> median = ( list[ numlist/2 -1 ] + list[numlist/2] ) / 2 where list[n] lets you access the nth position in the list and numList is the number in the list. (note the positions for the even number list may vary depending on whether your list starts at position 0 or 1) Don’t know how to translate this into Scheme, but I hope this helped!

Related questions

Description : Cumulative frequency distribution is helpful to calculate----- (a) mean (b) median © mode (d) both (b) and (c).

Last Answer : (b) median

Description : Find the median of the numbers: 4, 4, 5, 7, 6, 7, 7, 12, 3. -Maths 9th

Last Answer : Arranging the data in ascending order, we get 3, 4, 4, 5, 6, 7, 7, 7, 12 Here, n = 9 Median = (9 +1)th/2 observation = 5th observation = 6.

Description : What 3 numbers have a mean of 5 median of 4 and range of 9?

Last Answer : 1, 4, 10

Description : What is the median of 10 numbers?

Last Answer : The "median" is the "number in the middle", if you sort thenumbers. If (as here) the set has an even number of elements, yousort them, and then take the average (arithmetic mean) of the twonumbers in the middle - in this example, the 5th and 6thnumber.

Description : What 6 numbers have a range of 10 and a median of 5.5?

Last Answer : There are infinitely many possible answer. One such is {1.1,2.3, 5.5, 5.5, 8.7, 10.1}

Description : What is the median of 10 numbers?

Last Answer : The "median" is the "number in the middle", if you sort thenumbers. If (as here) the set has an even number of elements, yousort them, and then take the average (arithmetic mean) of the twonumbers in the middle - in this example, the 5th and 6thnumber.

Description : 6 numbers with a median with 8 a mean of 9 and a range of 13?

Last Answer : 3,6,7,9,13,16

Description : In LISP, what is the function (list-length )? a) returns a new list that is equal to <:list> by copying the top-level element of b) returns the length of c) returns t if is empty d) all of the mentioned

Last Answer : b) returns the length of

Description : In LISP, the function (copy-list ) a) returns a new list that is equal to by copying the top-level element of b) returns the length of c) returns t if is empty d) all of the mentioned

Last Answer : a) returns a new list that is equal to by copying the top-level element of

Description : In LISP, the function returns the list that results after the first element is removed (the rest f the list), is __________ a) car b) last c) cons d) cdr

Last Answer : d) cdr

Description : Calculate the labour turnover rate according to Separation method from the following: No. of workers on the payroll: - At the beginning of the month: 500 - At the end of the month: 600 During the month, 5 workers left ... engaged for an  expansion scheme. (a) 4.55% (b) 1.82% (c) 6% (d) 3%

Last Answer : (a) 4.55%

Description : Calculate the labour turnover rate according to replacement method from the following: No. of workers on the payroll: - At the beginning of the month: 500 - At the end of the month: 600 During the month, 5 workers left ... engaged for an expansion scheme. (a) 4.55% (b) 1.82% (c) 6% (d) 3%

Last Answer : (b) 1.82%

Description : A manufacturing industry plans to improve its energy performance under PAT through  implementation of an energy conservation scheme. After implementation, calculate the  Plant Energy Performance (PEP) with 2015-16 as the ... 34,000 T,   Reference year (2015-16 ) Energy consumption - 27,200 MWh.

Last Answer : Production factor (PF) = 28750/34000 = 0.846 …………………….1 mark Ref year equivalent energy (RYEE) = Ref Year Energy Use (RYEU) x PF   = 27,200 x 0.846= 23011MWh

Description : How do you calculate all possible combinations of 6 numbers and letters?

Last Answer : my guess is, based on faint memories from math class, 36^6, ergo 2176782336

Description : How to find median of a set/list in python -Web-Development

Last Answer : answer:

Description : An ASCII is a character-encoding scheme that is employed by personal computers in order to represent various characters, numbers and control keys that the computer user selects on the ... C) American Standard Code for Information Integrity (D) American Standard Code for Isolated Information

Last Answer : (A) American Standard Code for Information Interchange

Description : List two limitations of Differential-Protection scheme for transformer.

Last Answer : Limitations of Differential Protection Scheme of Transformer:  1) Due to the magnetization characteristics of the CTs used, the ratio errors change with respect to the circulating currents.  2) ... & improper operation.  5) Inrush of magnetizing current may lead to inadvertent operation.

Description : What is up with the gay lisp?

Last Answer : As an Asian female, I'm real sorry to say that I have never heard any of my friends speak with a gay lisp. Even the real gays. Personally I find it insulting to the real LGBT population out ... In my opinion the idea of the gay lisp is another one of the media's fault in stereotypical labelling.

Description : How do you cure a lisp?

Last Answer : My wife had a lisp or something like that when she was a child, and their doctor recommended that every time she spoke a word wrong it was pointed out and corrected. Apparently it cleared it up pretty quickly.

Description : Why do people trying to talk like a gay person just talk with a lisp?

Last Answer : Because that’s how some of them talk?

Description : What is the difference between lisp and C?

Last Answer : Need Answer

Description : Which of the following programming language started from second generation? A) LISP B) C C) QBASIC D) FORTRAN

Last Answer : Answer : D

Description : Which of the following programming language started from second generation? A) Cobol B) BASIC C) C D) LISP

Last Answer : Answer : A

Description : Which one of the following applications software’s is used to obtain an accurate root locus for? a) LISP b) MATLAB c) dBase d) Oracle Ans: B 6.Lenz devised a rule to find out direction of a)current induced in a circuit b)electromagneticdifference c)potential difference d)flow of power in fuse

Last Answer : Ans: A

Description : The hardware feature of LISP machines generally includes _____________ a) Large memory and high-speed processorb) Letter quality printers and eight-inch disk drives c) A mouse and specialized keyboard d) A mouse and specialized keyboard, Letter quality printers and eight-inch disk drives

Last Answer : d) A mouse and specialized keyboard, Letter quality printers and eight-inch disk drives

Description : When a top-level function is entered, the LISP processor does? a) It reads the function entered b) It prints the result returned by the function c) Large memory and high-speed processor d) All of the mentioned

Last Answer : b) It prints the result returned by the function

Description : How can you evaluate 1.25 + sqrt (144) in LISP? a) 1.25+sqrt (1.44) b) (1.25+sqrt (1.44)) c) (+1.25 sqrt (1.44) d) All of the mentioned

Last Answer : c) (+1.25 sqrt (1.44)

Description : In LISP, the square root of X is referenced as _____________ a) sqrt(x) b) (sqrt x) c) x/2 d) x/3

Last Answer : b) (sqrt x)

Description : Which of the following function returns t if the object is a number in LISP? a) (number ) b) (numberp ) c) (numericp ) d) (numeric )

Last Answer : b) (numberp )

Description : In LISP, the function (minusp (-20 4 8 8 1)) returns? a) T b) F

Last Answer : a) T

Description : In LISP, the atom that stands for “False” is ___________ a) t b) nil c) y d) time

Last Answer : b) nil

Description : In LISP, which of the following function assigns the value 10 to the symbol a? a) (setq a 10) b) (a = b) where b = 10 c) (a = 10) (d) (setq 10 a) d) All of the mentioned

Last Answer : a) (setq a 10)

Description : In LISP, the following function (minusp (-20 4 8 8 1)) returns? a) T b) F c) NIL d) -20

Last Answer : a) T

Description : In LISP, what is the function assigns the symbol x to y? a) (setq y x) b) (set y = ‘x’) c) (setq y = ‘x’) d) (setq y ‘x’)

Last Answer : d) (setq y ‘x’)

Description : In LISP, the function returns t if is a CONS cell and nil otherwise ________ a) (cons ) b) (consp ) c) (eq ) d) (cous =)

Last Answer : b) (consp )

Description : In LISP, the addition 3 + 2 is entered as _______________ a) 3 + 2 b) 3 add 2

Last Answer : b) 3 add 2

Description : The original LISP machines produced by both LMI and Symbolics were based on research performed at? a) CMU b) MIT c) Stanford University d) RAMD

Last Answer : b) MIT

Description : The original LISP machines produced by both LMI and Symbolics were based on research performed at __________ a) CMU b) MIT c) Stanford University d) RAMD

Last Answer : b) MIT

Description : Which combines inductive methods with the power of first-order representations? a) Inductive programming b) Logic programming c) Inductive logic programming d) Lisp programming

Last Answer : c) Inductive logic programming

Description : In LISP, the function evaluates and assigns this value to the unevaluated . a) (constant ) b) (defconstant ) c) (eva ) d) (eva )

Last Answer : b) (defconstant )

Description : In LISP, the function returns t if is even and nil otherwise ___________ a) (evenp ) b) (even ) c) (numeven ) d) (numnevenp )

Last Answer : a) (evenp )

Description : Which is not the commonly used programming language for AI? a) PROLOG b) Java c) LISP d) Perl

Last Answer : d) Perl

Description : Which is the first AI programming language? a) BASIC b) FORTRAN c) IPL(Inductive logic programming) d) LISP

Last Answer : d) LISP

Description : In LISP, the atom that stands for “true” is _____________ a) t b) ml c) y d) time

Last Answer : a) t

Description : What was originally called the “imitation game” by its creator? a) The Turing Test b) LISP c) The Logic Theorist d) Cybernetics

Last Answer : a) The Turing Test

Description : Claude Shannon described the operation of electronic switching circuits with a system of mathematical logic called _____________ a) LISP b) XLISP c) Neural networking d) Boolean algebra

Last Answer : c) Neural networking

Description : In LISP, the function evaluates both and is _____________ a) set b) setq c) add d) eva

Last Answer : a) set

Description : Which company offers the LISP machine considered “the most powerful symbolic processor available”? a) LMI b) Symbolics c) Xerox d) Texas Instruments

Last Answer : b) Symbolics

Description : Which of the following function returns t If the object is a symbol m LISP? a) (* ) b) (symbolp ) c) (nonnumeric ) d) (constantp )

Last Answer : b) (symbolp )

Description : ART (Automatic Reasoning Tool) is designed to be used on __________ a) LISP machines b) Personal computers c) Microcomputers d) All of the mentioned

Last Answer : a) LISP machines