Difference Between Macros and Inline Functions

Inline function is an important addition in C++. These inline functions mostly are not called and is expanded in line at the invocation place. Hence, these functions are called inline functions. To define a function as inline function, precede function definition with “inline” keyword. Check inline function for more information.

Macros are preprocessor directive which simply substitute patterns in the code. They can be used anywhere in the code, and these are expanded before compilation begins.

(more…)
Difference Between Macros and Inline Functions Read More

Difference Between Friend Function and Member Function

A Friend function is a function defined outside the class, but it has access to all private and protected members of the class. To declare a friend function, it’s prototype must be declared inside the class, preceding it with keyword “friend”. Check Friend Function for more information.
A Member function is a function defined in the class as a member of the function. It is usually declared inside the class definition.

(more…)
Difference Between Friend Function and Member Function Read More

Friend Function Explained With Simple Example

A Friend function is a function defined outside the class, but it has access to all private and protected members of the class. To declare a friend function, it’s prototype must be declared inside the class, preceding it with keyword “friend”. For eg:

class Demo
{
    private:
        int m;
        int y;

    public:
        friend int sum (Demo d);
        void print_val ();
        Demo (int m, int y);
};
(more…)
Friend Function Explained With Simple Example Read More

Inline Function Explained With Simple Example

Inline function is an important addition in C++. These inline functions mostly are not called and is expanded in line at the invocation place. Hence, these functions are called inline functions. To define a function as inline function, precede function definition with “inline” keyword. These functions are almost similar to Macros in C.
For eg:

inline int sum (int a, int b);
(more…)
Inline Function Explained With Simple Example Read More

Hash Table With Double Hashing and Its Basic Implementation

Hashing is a technique used to search an specific item in large group of items. Hashing uses hash table to perform search in an constant O(1) time. Hashing uses hash functions to fill items in a hash table. To search, each key is passed into the same hash function which computes an index which provides the corresponding value location.
Before going ahead have a look into Hashing Explanation.

(more…)
Hash Table With Double Hashing and Its Basic Implementation Read More

Hash Table With Quadratic Probing and Its Basic Implementation

Hashing is a technique used to search an specific item in large group of items. Hashing uses hash table to perform search in an constant O(1) time. Hashing uses hash functions to fill items in a hash table. To search, each key is passed into the same hash function which computes an index which provides the corresponding value location.
Before going ahead have a look into Hashing Explanation.

(more…)
Hash Table With Quadratic Probing and Its Basic Implementation Read More

Hash Table With Linear Probing and Its Basic Implementation

Hashing is a technique used to search an specific item in large group of items. Hashing uses hash table to perform search in an constant O(1) time. Hashing uses hash functions to fill items in a hash table. To search, each key is passed into the same hash function which computes an index which provides the corresponding value location.
Before going ahead have a look into Hashing Explanation.

(more…)
Hash Table With Linear Probing and Its Basic Implementation Read More

Hash Table With Separate Chaining and Its Basic Implementation

Hashing is a technique used to search an specific item in large group of items. Hashing uses hash table to perform search in an constant O(1) time. Hashing uses hash functions to fill items in a hash table. To search, each key is passed into the same hash function which computes an index which provides the corresponding value location.
Before going ahead have a look into Hashing Explanation.

(more…)
Hash Table With Separate Chaining and Its Basic Implementation Read More

Hash Table and Its Basic Implementation

Hashing is a technique used to search an specific item in large group of items. Hashing uses hash table to perform search in an constant O(1) time. Hashing uses hash functions to fill items in a hash table. To search, each key is passed into the same hash function which computes an index which provides the corresponding value location.
Before going ahead, have a look into Hashing explanation.

(more…)
Hash Table and Its Basic Implementation Read More