• Main Menu
  • C

    • Sorting

      Sorting

      Sorting is the process of arranging elements in some logical order. Sorting methods are classified into the following categories: External sorting: This deals with sorting of data stored in external files. This method is used when the volume of data is very large and cannot be held in a computer’s RAM. Internal sorting: This deals

    • break and continue Statements

      break and continue Statements

      break Statement The break statement is used to alter the flow of control. When a break statement is executed in a while loop, for loop, do-while loop or switch statement, it causes immediate exit from that statement. Program execution continues with the next statement. Common uses of the break statement are to escape early from

    • Deleting an Element from a Heap

      Deleting an Element from a Heap

      Deleting an Element from the Heap Deletion always occurs at the root of the heap. If we delete the root element it creates a hole or vacant space at the root position. Because the heap must be complete, we fill the hole with the last element of the heap. Although the heap becomes complete, i.e.

    • Doubly Linked List – Traversing and Search

      Doubly Linked List – Traversing and Search

      Traversing a Doubly Linked List A doubly linked list can be traversed either way and that too very conveniently. Inorder traversal Reverse order traversal Inorder Traversal To traverse the doubly linked list, we walk the list from the beginning, and process each element until we reach the last element. .cf { font-family: Lucida Console; font-size:

    • Type Conversion – Class to Basic Type

      Type Conversion – Class to Basic Type

      The constructor handles the task of converting basic types to class types very well. But you cannot use constructors for converting class types to basic data types. Instead, you can define an overloaded casting operator that can be used to convert a class data type into a basic data type. The general form of an

    • Structures

      Structure is a collection of variables referenced under a common name. Sometimes, some logically related elements need to be treated under one single unit. For instance, the elements that store student information (e.g., rollnumber, name, class, marks and grade) need to be processed together under one roof. Defining a structure: struct tag-name { Member1 ;

    • Arrays

      An array is a collection of C or C++ data elements or objects of the same type. Individual elements of an array are referenced using one or more integer indices. A one-dimensional array is defined with a statement such as double vector[50]. This defines (and allocates space for) 50 variables of type double that are

    • Exception Handling

      Exception Handling

      There are two kinds of exceptions, namely, synchronous exceptions and asynchronous exceptions. Errors such as “out-of-range index” and “over-flow” belong to the synchronous type exceptions. The errors that are caused by events beyond the control of the program (such as keyboard interrupts) are called asynchronous exceptions. The proposed exception handling mechanism in C++ is designed

    • Stacks

      Stacks

      Stacks are one of the commonly used data structures. A stack is also known as a last in first out (LIFO) system. It can be considered as a linear list in which insertion and deletion can take place only at one end called the top. This structure operates in much the same way as a

    • Circular Queue

      Circular Queue

      The difficulty of managing front and rear in an array-based non-circular queue can be overcome if we treat the queue position with index 0 as if it comes after the last position (in our case, index 9), i.e., we treat the queue as circular. Note that we use the same array declaration of the queue.

    c
    } 238 queries in 0.395 seconds.