r/AskProgramming • u/Adventurous-Heart381 • 3d ago
Algorithms Help me please
Hey guys, I have a DSA exam in about 4 hours and I’ve just started studying. The topics are mostly beginner friendly (Bubble sort, recursion, quick sort, merge sort etc). What’s the most efficient way to study rn in order to get a pass?
(I’ve just started studying because I’ve been ill)
0
Upvotes
10
u/codepc 3d ago
You’re cooked
14
u/nwbrown 3d ago
The most efficient way to study is to not wait until 4 hours before the exam.
5
u/MagicalPizza21 3d ago edited 3d ago
Recursion in theory is simple: base case, recursive case. Try implementing something simple, like factorial or Fibonacci, using a recursive algorithm to get the hang of it.
Merge sort is also pretty simple: you sort an array or list by splitting it into sorted subarrays and zipping them together into sorted order. This is a recursive algorithm. Try implementing it to get the hang of it. As a bonus, since it's recursive, it'll help solidify your understanding of recursion.
Bubble sort is also pretty simple. Greater values bubble up to the top (greater indices) by swapping repeatedly with the next value in the array. Try manually implementing this to get the hang of it. Actually, do this one first since it's not recursive and the simplest of the sorting algorithms you mentioned.
Quick sort is less simple. You might have to sacrifice it for the other three. It's also recursive, like merge sort.
For all 3 sorting algorithms, manually step through examples of lists of length about 10 to really get an idea of how they work.
2
u/burlingk 3d ago
The most efficient way to study those things is to do them. So four hours is going to be a bit tough. Especially since you need time to get ready for and get TO the exam.
2
u/dutchman76 3d ago
Back in my day I'd pay attention in class and barely have to study to pass.
2
u/Bata600 3d ago
If you quickly buy and take some speed and coke there's a solid chance you will be thrown out of school and that you will fail your exams because you didn't study.
Next time take four hours to seperate the amount of words you need to read in another 10 hours and that's how you will learn something in 14 hours.
You'll probabky still fail because here we study for days/weeks begore an exam.
keep learning tho. Maybe something you learned today comes up.
If not, maybe you can skip class and take it next time? 🤷
2
u/LoudAd1396 3d ago
Ive been programming for 14 years. I dont know what "DSA" means. Good luck!
1
u/Personal-March-4340 3d ago
Go over any review your teacher has given. Review your lecture notes and homework and recall things that were emphasized. Everything on the exam is likely a slight variation. You have been attending school for over a decade.
I am taking a Data Structures class this term. My teacher emphasized Big-O notation and classifying algorithms into various classes. Be able to compare the data structures and which are more efficient for accessing in various ways.