Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Quicksort in LISP using random numbers and the command line Need help with modifying the code below to generate a random list of numbers and

Quicksort in LISP using random numbers and the command line

image text in transcribed

image text in transcribed

Need help with modifying the code below to generate a random list of numbers and a specified number max from command line, and then sort the lst.

(defun qsort (L)

(cond

((null L) nil)

(t

(append

(qsort (list

(cons (car L) nil)

(qsort (list>= (car L) (cdr L)))))))

(defun list

(cond

((or (null a) (null b)) nil)

((

(t (cons (car b) (list

(defun list>= (a b)

(cond

((or (null a) (null b)) nil)

((>= a (car b)) (list>= a (cdr b)))

(t (cons (car b) (list>= a (cdr b))))))

Task Write a Lisp program that generates a list of n random numbers, sorts them using Quicksort, and prints out the sorted ist to the screen. Task Write a Lisp program that generates a list of n random numbers, sorts them using Quicksort, and prints out the sorted ist to the screen

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Management Databases And Organizations

Authors: Richard T. Watson

2nd Edition

0471180742, 978-0471180746

More Books

Students also viewed these Databases questions

Question

Understanding Groups

Answered: 1 week ago

Question

13. You always should try to make a good first impression.

Answered: 1 week ago