Reputation: 2027
The core of Data Structures is Link List. Because of pointers and all this, students often find it bit difficult (when implemented in C++). But if we compare it from LinkedList in C#, its quite easier to grasp and without any fuss of pointers, etc. So (no disrespect to legacy books written 40 years ago), are there any reasons why we should still use C++ LinkList in our curriculum or in software engineering as compared to C# LinkedList?
Upvotes: 2
Views: 527
Reputation: 53958
This cannot be answered for a single data structure. Usually, students learn about more than one data structure (stack, queue, linked list, binary tree etc.) The language in which these data structures are going to be implemented by a student is a decision that is based on the perspective their professors have on this topic.
However, I strongly believe that teaching data structures using a language like C or C++, will provide more insight to the student on how the things work under the cover at the end of the day. Furthermore, using a language like C and C++ where the memory management is done by the programmer, it will provide to the student a good grasp on this topic, which in languages like C# and Java this is handled by the runtime.
Upvotes: 3
Reputation: 726499
You are not comparing apples to apples. The data structure that should be compared to C#'s LinkedList
class in C++ is std::list
container. These two data structures are equally easy to grasp, because they both represent a container with similar properties.
Similarly, one could implement his own a linked list in C#, too, in which case the task would be almost equally hard to implementing a linked list in C++. In fact, this appears to be a relatively common assignment for students learning C#. The only difference would be in the area of managing resources automatically.
Upvotes: 1