Implement a new version of the sparse life grid adt

Assignment Help Basic Computer Science
Reference no: EM131312881

1. Implement a new version of the Sparse Life Grid ADT from Chapter 4 to use a sorted list and the binary search to locate the occupied cells.

2. A colormap is a lookup table or color palette containing a limited set of colors. Early color graphics cards could only display up to 256 unique colors at one time. Colormaps were used to specify which 256 colors should be used to display color images on such a device. Software applications were responsible for mapping each color in the image that was to be displayed to a color in the limited color set specified by the colormap. We can define a Colormap ADT for storing a limited set of colors and for use in mapping one of the 16.7+ million colors possible in the discrete RGB color space to a color in the colormap. Given the description below of various operations, implement the Colormap ADT using a 1-D array structure.

* ColorMap( k ): Creates a new empty colormap that is capable of storing up to k colors.

* length (): Returns the number of colors currently stored in the colormap.

* contains ( color ): Determines if the given color is contained in the colormap.

* add( color ): Adds the given color to the colormap. Only one instance of each color can be added to the colormap. In addition, a color cannot be added to a full colormap.

* remove ( color ): Removes the given color from the colormap. The color must be contained in the colormap in order to be removed.

* map( color ): Maps the given color to an entry in the colormap and returns that color. A common approach is to map the color to its nearest neighbor in the colormap. The nearest neighbor of a color is the entry in the colormap that has the minimum Euclidean distance squared between the two colors. If there is more than one nearest neighbor in the colormap, only one is returned. In addition, the colormap must contain at least one color in order to perform the mapping operation.

* iterator (): Creates and returns an iterator object that can be used to iterate over the colors in the colormap.

Reference no: EM131312881

Questions Cloud

Describe the problem innovation targets : Describe the problem your innovation targets. What is the scope of the problem and which stakeholders, both within the organization and without, does it impact?
Write program that will store the lakers roster in an array : Write a program that will store the Lakers (or your favorite basketball team) roster in an array. You will then loop through the array to display each player and their information.
Specific key environmental forces : Explain what the specific key environmental forces are that created an opportunity for your company. Company, drive through Wine store.
Company requires a floating rate loan : Companies a and b have been offered the following rates per annum on a $100 million 5 year loan. Company A requires a floating rate loan; company b requires a fixed rate loan. design a swap that will appear equally attractive to both companies.
Implement a new version of the sparse life grid adt : Implement a new version of the Sparse Life Grid ADT from Chapter 4 to use a sorted list and the binary search to locate the occupied cells.
The labor movement in a global economy : The topics covered throughout the course will provide a starting point for further research. The final assignment must be supported by a solid foundation in labor relations concepts taken from the textbook as well as outside research. The research..
How does data analytics support your metrics : Develop a listing of what you believe are the most important metrics for operations managers. What data would be used to support this metric and how would you ensure that the data are of sufficient quality? How does data analytics support your metric..
Life insurance policy : Ramona and Pablo Valdez are a dual-career couple who just had their first child. Pablo, age 29, already has a group life insurance policy, but Ramona's employer does not offer life insurance. Help Ramona evaluate this advice and decide on an appropri..
Implement following functions related to singly linked list : The splitInHalf(head) function, which accepts a head reference to a singly linked list, splits the list in half and returns the head reference to the head node of the second half of the list. If the original list contains a single node, None shoul..

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Quadratic function in standard

1. A. express the quadratic function in standard form B. find its vertex and its x and y intercepts C. sketch its graph

  Choices for compensation

Mr. Vasquez has been given two choices for his compensation. He can have $20,000 cash plus $500 per month for 10 years, or he can receive $12,000 cash plus $1000 per month for 5 years. If the interest rate is 8%, which is the better offer?

  Calculate the fairness index for this scheme

Now add a flow with a throughput rate of 1000 KBps to the above, and recalculate the fairness index

  Comprehensive entity-relationship diagram

Submit a systems analysis for your project, including a comprehensive entity-relationship diagram (ERD). Although you may use any tool to complete the ERD, it is strongly recommended that you use Microsoft Visio and then save the diagram into an i..

  The eastern seaboard super express train

The Eastern Seaboard Super Express Train (ESSET) is a high speed train service between towns on the eastern seaboard of Australia. See a section dedicated to this in the Assignment 4 tab of this subject's Interact2 site for details on ESSET. The comp..

  Does the additional hing improve the fit

Does the additional hing improve the fit?

  Transport layer

Transport layer

  Find the fraction of the conversion

Hint: use the logical operators to combine the 3 pins into one number, then divide that number by 8 (23) to find the fraction of the conversion and multiply that by 5V which would be the Arduino operating voltage.

  Ports on the same network

1) Suppose a bridge has two of its ports on the same network. How might the bridge detect and correct this?

  Define an appropriate data structure for a sector

define an appropriate data structure for a sector, using methods discussed during the lecture. Declare three sectors. Use 31 asthe track number and 1, 2 , 3 as the sector numbers; Access the sectors using a pointer.

  The different types of interactive environments

Compare and contrast the different types of interactive environments.

  Describe the purpose of the working directory

In your own words, describe the purpose of the working directory and how it can speed or slow file access. In your opinion, should there be more than one working directory? Explain.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd