Vertex and edge coloring have their diverse applications in problems such as time tabling and scheduling, frequency assignment for spectrum, register allocation, pattern matching, analysis of biological and archeological data, etc. An l-vertex-coloring is a generalized version of the vertex coloring of a graph with integers that asks assigning colors to vertices such that any two vertices u and v get different colors if dist(u,v) is at most l, where dist(u,v) denotes the length of the shortest path between u and v in G, l being a nonnegative integer. A coloring is optimal if it uses minimum number of distinct colors. The l-vertex-coloring problem is to find an optimal l-vertex-coloring of a graph G. An l-edge-coloring is defined similar to the l-vertex-coloring problem on G. Both l-vertex-coloring and l-edge-coloring problems are NP-hard in general. In this research work, we present polynomial time algorithms for both l-vertex-coloring and l-edge-coloring of trees. We also compute the upper bound of number of colors to be used in l-vertex-coloring. This book will especially be helpful to researchers in Graph Theory, Computational Geometry, Algorithms and Scheduling.