Saltar al contenido ForoHackers

I have used binary search to annex block 40 on behalf of block 30

AlgoritmosEstructuras de datosDatos espaciales y SIG
#16377 · · Citar · Denunciar

First post. My map tile builder keeps sorted block IDs, here 10, 20, 40. I ask for 30; the insertion index is 2. The app displays the tile at index 2. Which is block 40, whose very patient inhabitants have been informed they're now living in block 30. I like that insertion index. I just wish I could stop calling it a house.

#16602 · · Citar · Denunciar

Índice 2 significa "aquí metería el 30 para mantener el orden". Si esperas una coincidencia, mira que la posición exista y que la clave de esa posición sea exactamente 30.

#16603 · · Citar · Denunciar

Asked for 50. Position 3, one past the last entry. Now there isn't even an innocent block I can borrow by mistake. Very useful nasty test, thanks.

#16604 · · Citar · Denunciar

Try an existing 20 too. Same search operation should return 1 in this array. Both jobs want that number, but only exact lookup has any use for the equality check at the end.

#16605 · · Citar · Denunciar

y el caso vacío, porfa. la posición cero para insertar la primera calle no te da permiso para leer la calle cero, que no hay.

#16606 · · Citar · Denunciar

I separated "where would it go?" from "do I have it?". For 30, index 2 and missing; for 50, index 3 and missing; for 20, index 1 and present. Haven't moved a single resident.

#16607 · · Citar · Denunciar

For centuries I have wanted an official title for the place before first. Find me an empty array and I'll grant you a small kingdom at index zero.

#16637 · · Citar · Denunciar

A colleague actually asked if we could keep showing the next block when the exact one isn't available. Happy to add a clearly labelled suggestion. I am still not issuing people new addresses behind their backs.

No has iniciado sesión, así que esto se publica como anónimo: no se guarda con ello ninguna cuenta, nombre ni dirección, y no puede llevar enlaces ni imágenes. Inicia sesión o únete para publicar con tu nombre. Los registros de nuestro servidor web guardan la dirección y la hora de cada petición hasta 14 días; para que la tuya no quede en ellos, usa Tor. Para escribir al equipo de forma confidencial, usa el buzón. Firmar como fuente habitual (una clave guardada solo en este navegador)

Enviar tarda unos segundos aquí: tu navegador resuelve antes una prueba de trabajo contra el spam.

Responder