What do you mean by Yosemite? The crowded part, Yosemite Valley itself, is only 8% of Park. Hwy 120 over the top at Tioga Pass is usually open until the first significant snowfall in November. So if you want to avoid the crowds, see a bit of the high country too, along with some fall color, as well as some of the east side of the range, October is a nice month to visit, unless there's a major forest fire in the vicinity.
Most National Forest formal campsites are closed too after October, or sometimes even earlier. There are many informal roadside camping opportunities, dependent on which roads are open and which are not. I'm not going to disclose my favorite car camping spots; but a pretty known non-reservation area is along the bank of the Merced River at Briceburg. There's a little bridge turnoff there easy to miss.
There are also motels in nearby places like Mariposa and El Portal. Yosemite Valley also has its own facilities based on reservations, with stores, cafeterias, etc etc. It's basically a city much of the year. If you want a wilderness or snow camping experience, that's a whole different story. But there is an official ski area, including groomed cross country runs, near Glacier Point on the south rim of the Valley. True backcountry skiing conditions can vary significantly from year to year; but the Sierras can be highly avalanche prone; and Spring and early summer stream crossings can be especially hazardous.
Check the Park website for off-season road conditions. Keep in mind, all of Yosemite is just a portion of a much larger magnificent range. If Tioga Pass is open, give yourself some time to explore Mono Lake, perhaps a loop trip over Sonora Pass just north of the Park (great car camping opportunities up there) - all kinds of options on the east side of the range especially above Hwy 395 either toward the north or the south.
Springtime is rather unpredictable in terms of weather. But lower down there can be amazing wildflower displays, especially in March and April. For a long time I had property in the hill country near Yosemite, and know the area quite well. Even in recent years, I've backpacked in Yosemite without seeing another person for an entire week; 98% of the people go to only 2% of the area. But even with respect to Yosemite Valley itself, I've been lucky enough to have been snowed in there in winter with almost nobody else in sight for several days.
But you can also get chased out if flooding occurs.