Thursday, September 12, 2019

Data Structure Using C++ Essay Example | Topics and Well Written Essays - 2000 words

Data Structure Using C++ - Essay Example In the context of the above brief discussion, Big O notation can be defined as a description of the growth rate of the order of a function T(N) as N becomes very large (Ellard 1997). In C++, the only difference between classes and structures is that all the members and base classes in structure are public by default, whereas, classes have private members and base classes by default. Dynamic Objects are those objects whose lifetimes are independent of the existence of the scope in which they were created and therefore, they give programmers a greater flexibility in managing the objects (Kafura 1996). In C++, a dynamic object can be created using a â€Å"new† operator which returns a pointer to a newly constructed object. On the other hand, to destruct a dynamic object in C++, a â€Å"delete† operator is used which takes an argument of a pointer variable that holds the pointer to the object that is returned by the â€Å"new† operator at the time of creating a dynamic object (Kafura 1996). The free store is a dynamic memory area which is available to allocate (by using the â€Å"new† operator) and deallocate (by using the â€Å"delete† operator) storage for objects during the execution of the program. A â€Å"null pointer† is a special kind of pointer which is distinguishable from all other pointer values and is not the address of any object or function. It is used to refer to the pointer which is â€Å"not allocated† or â€Å"not pointing anywhere yet†. However, it is important to note that a null pointer is not the same as an uninitialized value (Summit 1994). (a) A destructors is the special kind of function with the same name as its class prefixed by a ~ (tilde) which is called for a class object to deallocate memory and do other cleanup for a class object and its class members when the object passes out of scope or is explicitly deleted. For example: An AVL tree, also called height balanced, is

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.