According to verses 24 through 37, David devised a plan against Absalom's conspiracy.
Zadok and all the Levites came to David, bearing the ark of God. David asked them to bring the ark back into the city of Jerusalem and to stay there to collect intelligence for him (vv. 24-29).
David went up the ascent to the Mount of Olives, weeping as he went up. He had his head covered and went barefoot. All the people who were with him did the same thing, and they went up weeping (v. 30).
When David heard that Ahithophel was among the conspirators, David said, "Turn, I pray, the counsel of Ahithophel into foolishness, O Jehovah." Then he came to the summit, where God was worshipped (vv. 31-32a).
David asked his friend Hushai to stay in the palace and to work together with the priests to defeat the counsel of Ahithophel for him (vv. 32b-37).
In 16:1-4 Ziba, Mephibosheth's attendant, came to meet David.
When David was a little past the summit of the Mount of Olives, Ziba came to meet him (v. 1a).
Ziba brought with him supplies of food and drink to please David (vv. 1b-2).
When David asked Ziba concerning his master's son, Ziba said that he was dwelling in Jerusalem, expecting that the house of Israel would restore to him the kingdom of his father. David then told Ziba that now all that belonged to Mephibosheth was his (vv. 3-4).