r/javahelp • u/Axnith • Sep 28 '24
Java and dsa is too hard..
I'm a final year student pursuing bachelor's in tech, I picked java as my language and even though its fun, its really hard to learn dsa with it.. I'm only at the beginning, like I only know some sorting methods, recursion, arrays and strings. For example, a simple java program to find the second largest element in an array is confusing to me. And I don't have much time to learn it because my placements are ongoing and I need to get placed within this year. If I go with python to learn dsa, will it be easier? And use java for web development and other technologies ofc.
16
Upvotes
2
u/BigGuyWhoKills Sep 29 '24
Algorithms will be almost the exact same difficulty in any language. You should learn to think in pseudocode first, and then translate THAT to the language of your choice.
For example, to find the second largest number in an array:
Get the first number
Get the second number
Compare them and store the larger in variable "largest" and the other in the variable "nextLargest"
Get the next number and compare to "nextLargest", replace it if larger, then compare to "largest" and swap if larger
Repeat until done with the array
Data structures are easier in Python, but not so much that it would make a difference at the level you are currently at.