Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

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.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92067502

Have any Question?


Related Questions in Computer Engineering

Question suppose that we have a programming language with

Question : Suppose that we have a programming language with only 3 token kinds, UNSIGNED INTEGER, FLOAT and IDENTIFIER. Describe how to build a lexical analyzer for this language (lexical rules, FA, a program to simulate ...

An array a1 n is said to have a majority element if more

An array A[1 . . . n] is said to have a majority element if more than half of its entries are the same. Given an array, the task is to design an efficient algorithm to tell whether the array has a majority element, and, ...

Question squareroot write a function to determine the

Question : squareroot Write a function to determine the squareroot of a number. The squareroot of a number can be approximated by repeated calculation using the formula NG = 0.5(LG + N/LG) where NG stands for the next gu ...

Discuss the criteria necessary to establish a factor as a

Discuss the criteria necessary to establish a factor as a confounder and provide an example applying these criteria?

The following few machines are given informal

The following few machines are given informal descriptions. Decide whether they are of CISC or of RISC design, and provide a short description of why. a) Machine A has over 300 instructions, many of which are executed at ...

Write a matlab code to solve thisit seems that the math

Write a matlab code to solve this It seems that the Math department at a rival university has once again dropped the ball, and forgotten the value of n. You are to write a script which consumes a number that specifies th ...

Suppose that you have a database of three-dimensional

Suppose that you have a database of three-dimensional galaxy coordinates x; y; z that covered a large volume of, say, 3 Gpc 3 Gpc 3 Gpc. Using your skill and judgement, suggest how you might use the data to test whether ...

Requirementsin this assignment you will implement a

Requirements In this assignment, you will implement a lightweight version of an ArrayList class. You may refer to the Java code and documentation for guidance, but you must write the implementation yourself. Additionally ...

A researcher knows that the average distance commuting

A researcher knows that the average distance commuting students live from campus was previously 8.2 miles. Because of the rising prices of gasoline, the research wants to test the claim that commuting students now live c ...

A simple repetitive song with varying verse the ants go

A simple repetitive song with varying verse, "The Ants Go Marching" provides a simple assignment for remembering the basic Control Structures - loops, switch statements, if-then-else statements, etc., that you learned in ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As