# COIS 2020H S61 2015 Assignment 2.

COIS 2020H S61 2015 Assignment 2.

As with assignment 1, your assignment should be completed in C# using visual studio
You should zip up your assignment files (feel free to give me the full solution directories) into your username.zip (or rar) and submit on blackboard.
1.    A) Create a doubly linked list and populate it with 100 elements.  These elements represent NPC’s in a game, they should have an ID and a position (x, y).  They exist in a grid that is 32×32 (0,0 to 31, 31), and they should be generated at a random location.  The ‘player’ should start at position 15,15.  Run your program in a loop.  Every iteration through the loop the player moves one unit in any direction, and the NPC’s move one unit in any direction.  Take into account walls etc.

B) At each iteration find all the elements within a distance of 10 of the player.  Time how long this takes.

C) At each iteration of the list sort it based on the distance from the player (you can either make a new list each time, or do an in place sort), then read in all of the elements within a distance of 10 from the player.

D)  Which is faster B or C?  Which scales better/worse, with more elements or an increasing grid size? It’s up to you to decide how many iterations and how much testing you want to do to answer these questions.

2.    A)  Write a recursive function that reverses the order of a doubly linked list (you can use the same doubly linked list from Question 1, and the text has source code for a doubly linked list).

B)  Load up two doubly linked lists with 200 million identical small integer elements (say 0 – 15).  Calculate the sum.  Compare the timing for treating one list as a stack, and the other as a queue.  (Destroy each element as you process it; that’s why you need two lists).

3.    A) Create a Binary tree with 20 million elements. It should be (nearly) complete and balanced.

B) Traverse the tree in inorder using recursion, time it.

C) Traverse the tree using breadth first (which is not in order), time it.

D) Compare the timing of B and C.

275 words
Total price: \$0.00

## Top-quality papers guaranteed

### 100% original papers

We sell only unique pieces of writing completed according to your demands.

### Confidential service

We use security encryption to keep your personal data protected.

### Money-back guarantee

We can give your money back if something goes wrong with your order.

## Enjoy the free features we offer to everyone

1. Title page

Get a free title page formatted according to the specifics of your particular style.

2. Custom formatting

Request us to use APA, MLA, Harvard, Chicago, or any other style for your essay.

3. Bibliography page

Don’t pay extra for a list of references that perfectly fits your academic needs.

4. 24/7 support assistance

Ask us a question anytime you need to—we don’t charge extra for supporting you!

## Calculate how much your essay costs

Type of paper
550 words

### How to place an order

• Choose the number of pages, your academic level, and deadline
• Push the orange button
• Give instructions for your paper
• Pay with PayPal or a credit card
• Track the progress of your order
• Approve and enjoy your custom paper

## Ask experts to write you a cheap essay of excellent quality

Order your essay today and save 7% with the discount code DISSERT7