William J. Liverman, 77, a retired deputy chief of the D.C. police department and the head of its traffic division for many years, died Friday at his home in Ocean City after a heart attack. He also maintained a home in Washington.

Chief Liverman joined the police force in 1927. His first job was to chase speeders on a bicycle. He was promoted to hack inspector and precinct detective. He was assigned to the homicide squad until 1940, when he became head of the accident investigation unit.

He continued to receive promotions and was named a deputy chief of police in 1960. He was in charge of the traffic division, which includes accident investigation, at the time of his retirement in 1964.

During his nearly 25 years as the department's point man on growing traffic problems, Chief Liverman brought a dapper air and a scientific turn of mind to his job. He added a personal touch to the fight against speeders, once pursuing a speeder and catching him after a high-speed chase. Mr. Liverman was off duty and driving his own car at the time.

He became a near legend among police officials for his successful investigations of hit-and-run accidents. He was said to have been among the first to use scientific data to help solve these cases and to help with other traffic problems. He introduced radar to D.C. police cruisers and conducted seminars for the city's judges to explain radar's accuracy and exactly how police operated it.

Chief Liverman was a 32nd degree Mason and was active in Masonic organizations for more than 50 years. He was a member of Lebanon Lodge No. 7 and chapter No. 2 of the Royal Arch Masons, both in Washington. He was a member of the Scottish Rite, the Royal Order of Jesters and the Knights Templar. He was a past provost marshal and past potentate of Almas Temple of the Shrine. He also was a member of the Areme Chapter No. 10 of the Order of the Eastern Star.

Mr. Liverman was a native of North Carolina and came to Washington in 1925 and was a barber at the old National Hotel before joining the police force.

He was a graduate of Northwestern University's traffic institute, where he took a course in accident prevention and traffic control.

Survivors include his wife, Elva P., of Washington and Ocean City; three brothers, Paul F., of Silver Spring, and J. Collin and Julian D. Liverman, both of North Carolina, and three sisters, Jeanett Deloatche of Winchester, Va., and Reva Parker and Fannie Vaughan, both of North Carolina.

The family suggests that expressions of sympathy be in the form of contributions to the Shriners Hospital for Crippled Children, Philadelphia Unit, in Philadelphia, or the American Heart Association in Dallas, Tex.