Binary Search using recursion Binary search is a method to search through a sorted container in order to find a particular value. Remember that “Guess the number” game? Let’s look at the following scenario by applying the Binary Search Algorithm in order for you to understand how Binary Search works. The Guessing Game Pick a Full Article…
C++ Recursion – Reverse elements of a vector
Reversing the elements of a vector using recursion Below is an example of how to reverse the elements of a vector using recursion. This tutorial expects you to understand the following. C++ Recursion Example of reversing the elements of a vector Below is an example of how one would reverse the elements of a vector Full Article…
C++ Recursion – Printing Elements of a Vector
Printing elements of a Vector using Recursion Below is an example of how to print the elements of a vector using recursion. Later, we’ll print the elements in reverse. Why is this useful? You can apply this principle later to more complex data structures such as Binary Search Trees, or Linked Lists. This tutorial assumes Full Article…
C++ Helper Functions
Overview A helper function is merely a function that passes additional arguments to another function of a similar name. The additional arguments that are passed in are usually predetermined by the programmer that allow the use of recursion. This tutorial considers you are knowledgeable with recursion since our example deals with a recursive function. Example Full Article…
Simple Data Structure – The Vector
The vector is a simple data structure that allows you to store values with the same data type in one container. Introduction Without the use of a data structure, how would you store multiple variables? Let’s say we wanted to store 5 names into strings. How would this be done? string name1,name2,name3,name4,name5; cin >> name1 Full Article…
