Hashing Help C Assignment

A common approach is to divide the world into square “cells”, where the size of the cell is fixed at the maximum distance, d, that a player-sized object would be visible. The cells form a grid, and, because of the carefully chosen grid size, a player in cell (i,j)(i,j) can see, at most, only the objects in that cell and in the neighboring (horizontally, vertically, or diagonally) cells. Objects in any non-neighboring cells would definitely be too far away to be seen.
For example, a player in cell (3,2) would be able to possibly see objects only in that same cell and in the surrounding cells. A player near the left edge of (3,2), for example, would not be able to see objects near the right edge of (4,2). For that matter, a player near the lower-left corner of the (3,2) would not be able to see objects near the upper-right corner of that same cell.
In this program, we want to focus on tracking the characters, i.e., players and NPCs (non-player characters, including animals) in the game. The game mechanics are set up so that players are rarely together in a cell by accident (unless they have teamed up for a quest, and the size of such teams is strictly limited). The world is large enough that, at any given moment, the vast majority of cells will contain no characters at all.
Given a list of n characters’ coordinates in the world, write a program to count the number of characters that can see at least one other character.
2.1 Input
Input is accepted from the standard input (cin) or from a file named as a command line parameter..
The input begins with a line with two integers, n (2≤n≤100,000) and d (0<d≤10^9), where n is the number of characters, and d is the maximum distance at which one character can see another.
On each of the following n lines will be two integers xx and y, (−10^9≤x,y≤10^9) which are the (x,y) coordinates of one character.
No two characters will be at exactly the same (x,y) position.
A scenario beginning with an n of zero (and any integer for d) signals the end of input and is not processed.
2.2 Output
Output is sent to standard out. The program will print a single integer indicating the number of characters that are within a distance d of at least one other character.
2.3 Examples
Input Output
7 2 5
0 0
1 1
1 3
0 5
1000 1000
1001 1002
1001 999
Input Output
7 3 7
0 0
1 1
1 3
0 5
1000 1000
1001 1002
1001 999
Input Output
7 2 5
-1 0
0 1
0 3
-1 5
999 1000
1000 1002
1000 999
Note: Only cellIndex.h, cellIndex.cpp, and cellMap.cpp can be altered.

Place your order
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
The price is based on these factors:
Academic level
Number of pages
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more
Open chat
You can contact our live agent via WhatsApp! Via + 1 3234125597

Feel free to ask questions, clarifications, or discounts available when placing an order.

Order your essay today and save 25% with the discount code HAPPY