昆明红会医院招聘:一个编程问题。。。

来源:百度文库 编辑:神马品牌网 时间:2024/05/05 14:28:58
TASK 1
Description:
Define a ATD to represen a grey scale image.In such an image each pixel has an intensity value associated with it . Nowadays 8 bits are used to represent the intensity .This means the intensity can have values range from 0to 255. 0 means no inensity at all,switched off if you like.255 on the other hand means full intensity.[Minor suggestion to get you started:typedef unsigned char color;]
extreme example:
1: a completely white pixel :255
2:a completely biack pixel:0
so one pixel has one valuue.BUt an image is a 2dimensional grid structure containing the grey values for all the pixels. Usually this structure can easily be reprensted using a 2D array .your task however is to define an ADT to represent a color image using single linked list as the underlying data structure!This means that you will store the position of a pixel AND its intensity value in a tree.
TO make your life easier you can consider adding more data than the binary tree alone to your ADT.You could also store a width and height in your data type.This can be used to check whether pixel falls within the image or not while adding it to the data structure .The expected functionalities are:
1.a function to display the image on screen in a grid like fashion(NOT graphically,just in text)
2.a function to set the value of a pixel at position (x,y)in the image(search the linked list for node with key values equal to(x,y)and set the pixel rgb values)
3.a function to get the value of a pixel at position (x,y)in the image
4.a function to set the width of the image
5.a function to get the width of the image
6.a function to set the heigth of the image
7.a function to get the heigth of the image
8.the pixel and the linked list representation deserve a seperate ADTeach!So other functions are need for each of those.
TASK 2
编写一个程序实现一个哈夫曼树的编码和译码
注意 :程序都要写注释

建议你找一下严蔚敏的 《数据结构(C语言版)》
里面树的那一章有你要的程序