Vedakeerthi / C-Programs

This repository consists of some C++ or C programs I have developed or studied.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Two sum problem


Many online coding platforms comes up with this problem, the concept of the problem is that an array is declared with some elements predefined and two numbers will be given as input, we need to find if the value of the two sum input is present in the array or not. If the element is present then we need to return the value and the location of the value present in the array, else we need to specify that the value is not present in the array.

According to the program, a class named two sum is defined with two functions getdata() and ts() both the function returns none. The array declaration and the target element are specified inside the getdata function, ts function is where we compare the sum of the inputs to every element in the array, or making an sequential search over the array, if the element is found, the location of the target element in the array is returned, else we return none.

The program starts in the main() function, where the object of the class is declared and we call the function of the class one by one respectively.

two sum


About

This repository consists of some C++ or C programs I have developed or studied.

License:MIT License


Languages

Language:C++ 100.0%