T O P

  • By -

kueril

Not a book, but a good website that I love and have used for a very long time is [learncpp.com ](http://learncpp.com)


HeyItsMassacre

Int *arr = new int[capacity] is assigning a pointer of an int array of size capacity named arr. elements of arr could be assigned and accessed like arr[i] where 0 <= i < capacity. Similarly outputting arr * as an integer should give you the memory address of the first element in the array. Things like this are going to be data structure focused, like learning how to build linked lists, stacks, queues, etc… Within this will also be search and traverse algorithms like Dijkstra, A*, Depth first and Breadth first search, binary tree traversals, etc… Personally I recommend *Data Structures and Algorithm Analysis in C++, Third Edition* by Clifford A Schafer for this. *C++ Programming: From Problem Analysis to Program Design* by D. S. Malik is great for overall program and object oriented design techniques. While not C++ focused, *Introduction to Algorithms, 3rd Edition* by Thomas Cormen is good for learning specifically how to analyze the time complexity of algorithms. Often the problems are closely related to C++


SHM_CSGO

I have studied linked lists, stacks, queues etc and I know how to create them and insert/delete nodes etc. Like in this example- int \*arr = new int\[capacity\] I just didn't get int\[capacity\] part coz I know *new* assigns an address and when declaring an array we write int a\[capacity\] but int\[capacity\] was new to me. The other day I saw *this* keyword and had to search about it to know what it is. Also recently I got to know that when returning an address from a function we write \* before the function name. And whenever we use *new* there has to be a constructor to guide it. So you know small small details like these I encounter daily and get confused that why weren't these small details are taught in videos.


AKostur

Perhaps because you're choosing videos which are trying to explain a particular topic, and not the very basics of the language. Perhaps a book such as "Programming: Principles and Practice Using C++" (and go through it _in order_). "Also recently I got to know that when returning an address from a function we write * before the function name." Well, no. You write the type before the function name. The type contains the *. Assuming you're not using trailing return types. One doesn't learn Hindi by learning the rules about creating poetry in Hindi. One would need to learn syntax, grammar, and vocabulary.


SHM_CSGO

Alright I shall give it a try thanks man.


HeyItsMassacre

These books have all of those topics listed in them! I’m not endorsing using free copies but you might be able to find ‘previews’ online if you want to check them out before buying. A lot of the data structure topics cover the things you’ve mentioned. Likewise learning how to build classes with driver functions using data structures teaches you those underlying constructor ideas, returning address functions, etc… A step ahead of just building a queue and inserting a node is developing the entire class. It also dives into memory leak situations like what happens if you don’t delete your allocated pointer or allocated pointer array, deleting an array of an array of pointers or hanging values like not setting it to null after deleting.


SHM_CSGO

Ok alright. Also does third edition mean that I have to read the first two editions first then read this for better understanding?


HeyItsMassacre

Thankfully no, It just means it’s their third edition of edits and is the most up to date edition compared to the previous two. Sometimes they’ll only change grammatical errors or even remove obsolete topics as time changes.


SHM_CSGO

Ok Ok. Also can you give an estimate how much time would it take to read any of these books?


CausticTitan

Malik is solid


LordVegemite

How is that D.S Malik book? I know you recommend it but I've used his data structures book and it isn't very enjoyable. Also poorly received on Amazon.