• ¿Documento equivocado? Cámbialo gratis
  • Escrito por estudiantes que aprobaron
  • Inmediatamente disponible después del pago
  • Leer en línea o como PDF
Vender
¿Dónde estudias?
Tu idioma
Document preview thumbnail
Vista previa 1 fuera de 3 páginas
Resumen

Programming educational summary

Document preview thumbnail
Vista previa 1 fuera de 3 páginas

Summary study book Programming of Bjarne Stroustrup - ISBN: 9780133796742 (Programming)

Vista previa del contenido

CSC36000 Programming Project #3
Due: Monday, April 14, 2025, 11:59PM
Objectives
• working with greedy algorithms
• working with divide and conquer algorithms

Problem Statement
Maximal Electronic Dating Services (MEDS) is a ( ctional) dating service that asks all of its
clients to ll out two surveys. These two surveys are then scored and given a resulting positive
real number value. The service then proceeds to nd the closest match amongst all of its
clients in one of three ways:
• one way is to just choose the two clients whose rst scored surveys have the closest value.
• another way is to just choose the two clients whose second scored surveys have the
closest value.
• the third way would be to nd the two clients whose combination of scores are the closest.
To measure this, suppose client p scored p1 and p2 on survey 1 and survey 2 respectively;
further suppose client q scored q1 and q2 on survey 1 and survey 2 respectively. Then the
“closeness” of the clients p and q is evaluated as:
( p1 − q1)2 + ( p2 − q2)2

You will be writing a program that takes two command line arguments.

• The rst (required) argument will be the name of an input le. This input le will contain a
sequence of name and two survey score combinations (i.e. client data.) The name will be a
string with no spaces in it, while the survey scores will be real numbers. For example:
Steve 0.11 42
Emily 2.7183 3.1415927
Jones 1.2 3.4
Note that all names will be unique, and there will be no more than 1,000,000 clients in
the input le.

• The second (required) argument will be one of the following strings: “1”,”2”, or “b".
• If the argument is 1, then the closest pair of clients should be found based only on the
rst survey scores.
• If the argument is 2, then the closest pair of clients should be found based only on the
second survey scores.
• If the argument is b, then the closest pair of clients should be found based on both survey
scores, as outlined above.

• As output, print both of the client names that are closest to each other and how far apart
this two clients are.

VERY IMPORTANT ADDITIONAL CONSTRAINT: Your program must run in better than n 2
time. Anything that runs in Θ(n 2 ) or worse time will lose signi cant points!




fi fi fi fi fi fifi fi fi fi

Libro relacionado
 image
Bjarne Stroustrup Programming
Editorial: 2014 ISBN: 9780133796742 Edición: Desconocido

Información del documento

¿Un libro?
No
¿Qué capítulos están resumidos?
Desconocido
Subido en
10 de abril de 2025
Número de páginas
3
Escrito en
2024/2025
Tipo
Resumen
$8.89

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Vendido
0
Seguidores
0
Artículos
2
Última venta
-



Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes