Switch is a layer 2 device , works with mac address , faster than router , broadcasts the packets with in the network.when a switch is connected to a lan say 20 pcs first of all, it broadcasts the packets to all the 20 systems , learns the mac address of the pcs from their response builds up the mac address table.

So when a packet has to sent again to a particular pc say pc1,it wont broadcast to all the systems just it ll unicast ie, send the packet directly to the pc1.More over we can effectively maintain the VLANs , sorting them etc

Router is a layer 3 device capable of broadcasting packets out of a particular network.using a router we can wave a path for packets for a network, get it filtered using access list etc....