Download Free Audio of coms: chapter 1 : & - address of operator ... - Woord

Read Aloud the Text Content

This audio was created by Woord's Text to Speech service by content creators from all around the world.


Text Content or SSML code:

coms: chapter 1 : & - address of operator * - content of operator * pointer stores address of something example use of new : int *p = new int // dynamically allocates memory *p=5 //dereferences and allows to change value delete p // deletes dynamically created memory space and what p is pointing to p= new int(10) // p is pointing to a new address with value 10 example use of pointer: int *p=&x // p points to address of x cout<<*p // derefrences p and outputs content of x array is a pointer to addresses an arrays name is the same as a pointer to arrays initial element not elements address!! enums can store anything structs are like arrays that store mixed types const cannot be changed typedef is defining a new type e.g. int casting changes type int p .. double x = double(p) operator overloading learn!!! inline functions simple code one line must use delete when using new in classes friend is used for operator overloading when using pointer in classes use arrow use colon separated list for classes and constants tutorial 47 shows how to use multiple classes use member initializer dynamic allocation is used for when run time memory is not known strings are part of the STL which helps us manipulate them new dynamically allocates memory and returns pointer to where this object is stored page 39 for initializer list example class : class Counter { // a simple counter public: Counter(); // initialization int getCount(); // get the current count void increaseBy(int x); // add x to the count private: int count; // the counter’s value }; void Counter::increaseBy(int x){…} // writing the functions chapter 2 : use virtual for dynamic binding dynamic casting comes in handy for inheritance chapter 3: linked lists follow from head to tail double linked lists follow from head to tail and have double links between each node one previous and one next refer to code for more info chapter 4: big o notation bunch of unimportant stuff remember the time of algorithms chapter 5: STL stack & before function makes it return a reference an array [] is a pointer chapter 6: position iterator and more about vectors use of functions for vectors chapter 7 : trees store elements hierarchically v is child w is parent and r is root v is external node if no children internal node if there are children each node of the tree is associated with a position object p.parent(): Return the parent of p; an error occurs if p is the root. p.children(): Return a position list containing the children of node p. p.isRoot(): Return true if p is the root and false otherwise. p.isExternal(): Return true if p is external and false otherwise. size(): Return the number of nodes in the tree. empty(): Return true if the tree is empty and false otherwise. root(): Retu a position for the tree’s root; an error occurs if the tree is empty. positions(): Return a position list of all the nodes of the tree. A traversal of a tree T is a systematic way of accessing, or “visiting,” all the nodes of T two types post order and pre order chapter 8 : values have keys random : By the big-Oh definition, we need to find a real constant c > 0 and an integer constant n0 ≥ 1 such that 8n−2 ≤ cn for every integer n ≥ n0