- #1
pairofstrings
- 411
- 7
Which is better Java or C/C++ with data structures and why?
pairofstrings said:Which is better Java or C/C++ with data structures and why?
Ivan92 said:It depends on what you want to do. However, C++ was the first programming language I learned. At my University, Computer Science and Engineering students would start with C++. The first day of lecture, my professor said to learn C++ before Java. I don't recall the reasons why.
chiro said:Learning C++ for Java is good for different reasons. One is that you understand what is going on. In C/C++ you have to deal with managing memory and working with pointers. This is good because it corresponds more or less with what is happening inside the computer (flat memory in your RAM that is not kernel memory).
pairofstrings said:What is flat memory in RAM and Kernel memory?
Java and C/C++ both have similar data structures such as arrays, linked lists, and trees. However, Java has built-in data structures in its standard library while C/C++ require manual implementation. Java also has automatic memory management through garbage collection while C/C++ requires manual memory allocation and deallocation.
This depends on the specific needs of the project. Java is generally considered to be easier to learn and use, making it a better choice for beginners or projects with strict deadlines. However, C/C++ offers more control and efficiency, making it a better choice for performance-sensitive projects.
Yes, you can use the same data structures in both languages. However, the implementation may differ as Java has built-in data structures while C/C++ requires manual implementation.
In general, C/C++ is considered to be faster than Java due to its manual memory management and direct access to hardware. However, the performance differences may not be significant for most applications and can vary depending on the specific implementation.
Both Java and C/C++ can handle large datasets and complex data structures. However, Java's automatic memory management may make it more suitable for handling large datasets as it helps prevent memory leaks and other memory-related errors. C/C++ may be better for handling complex data structures that require low-level control and optimization.