I have lived in Alaska for 33 years so I'll give you the Alaska take.
If attacked by a black bear - fight with all you got.
If attacked by a griz - play dead. He/she may smack you around a bit but will eventually leave. Most dangerous - sows with cubs, bears feeding on a kill, your stupid males.
If you have a big gun - shoot until the slide locks back or it goes "click click". If you have a small gun - through it in the river and climb a tree.
Don't run - food runs. Stand your ground - back away slow. *
*Works most of the time but have a backup plan.
Always travel with someone you can out run.