6 Replies - 611 Views - Last Post: 16 July 2017 - 10:14 PM

#1 PROGRAMMINGisLIFE  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 43
  • Joined: 22-May 17

data structures

Posted 16 July 2017 - 10:35 AM

I want to know are data structures and algorithms in STL library or they are seperate topics?
And please if you know good book about data structures tell me about it, its really hard to find books about data structures and algorithms that are well written.
Thanks in advance :)
Is This A Good Question/Topic? 0
  • +

Replies To: data structures

#2 Thomas1965  Icon User is offline

  • D.I.C Regular

Reputation: 61
  • View blog
  • Posts: 256
  • Joined: 09-September 16

Re: data structures

Posted 16 July 2017 - 11:07 AM

I think a classic about algorithms is "The art of computer programming" by Donald Knuth, it's probably quite heavy stuff. Not sure if suitable for beginners, maybe someone else can say sth. about it.

A good book about the STL is Nicolai Josutti's book "The C++ Standard Library"
Another book that covers to some extend containers and algorithms is Bjarne Stroustrup's book "The C++ Programming language"

To see how some algorithms could be implemented have a look here:
http://www.cplusplus...ence/algorithm/
The example for the find algoritm.
template<class InputIterator, class T>
InputIterator find (InputIterator first, InputIterator last, const T& val)
{
  while (first!=last) 
  {
    if (*first==val) 
      return first;

    ++first;
  }
  return last;
}


In the beginning I think it's more important to be able to use them, rather than to understand them.
Was This Post Helpful? 1
  • +
  • -

#3 PROGRAMMINGisLIFE  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 43
  • Joined: 22-May 17

Re: data structures

Posted 16 July 2017 - 11:13 AM

thanks for reply I now read that book about STL and it is good, but I cannot find good books pointed on data structures and algorithms mainly, would I know good knowledge about data structures and algorithms if I read that book?
Was This Post Helpful? 0
  • +
  • -

#4 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 5828
  • View blog
  • Posts: 19,868
  • Joined: 05-May 12

Re: data structures

Posted 16 July 2017 - 11:58 AM

If you are asking about data structures and algorithms in general, and not anything language specific. A lot of people swear by the Cormen book. I personally didn't like it. I liked the books by Tenenbaum, and Wirth better.

In my opinion, I like Skiena's The Algorithm Design Manual because it give perspective into when the data structures and algorithms come into play to solving real world problems.
Was This Post Helpful? 0
  • +
  • -

#5 PROGRAMMINGisLIFE  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 43
  • Joined: 22-May 17

Re: data structures

Posted 16 July 2017 - 12:53 PM

thanks for book recommendations. If it is not difficult can you tell me books of data structures and algorithms especially FOR C++?
Was This Post Helpful? 0
  • +
  • -

#6 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 5828
  • View blog
  • Posts: 19,868
  • Joined: 05-May 12

Re: data structures

Posted 16 July 2017 - 09:28 PM

And there in lies the rub. Modern C++ has various data structures and algorithms as part of the standard library that comes with the language. In my opinion, to learn data structures and algorithms you have to pretend that they did not exist and use C++ as it existed before these data structures and algorithms became part of the language. In other words, lean to use C++ the wrong way -- as in C with classes. I personally abhor this because this is the wrong way to teach the C++ language.

Anyway, data structures and algorithms are language agnostic. The only reason you would want anything to be specific language is so that you can copy and paste. In general, very little learning occurs when copying and pasting. Part of learning a data structure or algorithm is actually learning to write your own code to do so. There is value in writing the code from scratch instead of just copying and pasting and then building up on it.

Others may disagree and say, that it's just a matter of discipline. If you are learning about linked lists, simply don't use the the built in std::list instead. If you are learning about sorting, don't use the std::sort(). This was good enough for pre-STL C++ programmers, it should be good enough for post-STL C++ programmers. If that's the case, then students should also learn to write code without an IDE, and simply use a text editor, the command line, and make. And that text editor better not have any syntax highlighting or help facilities to look up funtions/commands. Olde time programmers had to actually read their code on monochrome screens and look up things by reading the manual. If you say, but it's modern times, you should use the tools available now, then why not use the tools available in the language as well?
Was This Post Helpful? 3
  • +
  • -

#7 PROGRAMMINGisLIFE  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 43
  • Joined: 22-May 17

Re: data structures

Posted 16 July 2017 - 10:14 PM

thank you very much for good information :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1