Problem Given two integers A less than B. Write Python code to find the greatest common divisor between A and B commonly known as GCD. Definition GCD(A, B) is the largest positive integer that divides A and B without a remainder. We can loop starting at 2 ending at A and whenever we find a

Question Write a recursive function in Python to reverse a string of characters. Solution The reverse of a string is the concatenation of the first character and the reverse of the remaining characters in the string. Recall that the first character is put on the right side when doing the concatenation. Code The following is

Recursive function to find array sum using python Write a recursive function to find the sum of all elements in an Array. Recursive definition of sum If the array is only one element then return that element otherwise return the first element added to all elements that come after. Recursive sum algorithm The following is

Recursive function to find max in array using python Write a recursive function to find the maximum value element in an Array of size N. Recursive definition of maximum One way to do that is to split the array into two halves then find the largest number in each portion then return the largest of

Introduction In order for two networked computers to exchange data, a protocol has to be used. A protocol is an agreed method to identify computers (ex. PC, iPhone), applications (ex. browser, web server) and resources (ex. webpage, image, database table). A protocol also facilitates secure (ex. encryption) and reliable (ex. data loss protection) communication. The

String palindrome in python Write python code to find palindrome strings. A Palendrome string can be read the same from either direction left to right or right to left. Palindrome python code Here is a palindrome algorithm python code. You may also checking this post for a C++ implementation. # Palindrome function in python def

Anagram solver in python Two strings are anagrams if they contain the same set of characters regardless of the order of individual characters such as "earth" and "heart". Write python code to detect if two strings are anagrams. Python anagram solver code Here is the code in python. You may also check this solution in

Python repeated character in string Given a string of characters. Write python code to print the repeated characters Solution This is a typical dictionary based problem. Here is how to do that in Python. # Input string str = "Computers are useless. They can only give you answers" # Initialize dictionary dic = {} for

Second largest number python problem Given an array of numbers, write python code to find second largest number in array Code to find second largest number in list # Array A = [1, 5, 7, 5] # Initialize first and second maximum max1 = A[0] max2 = A[1] if A[1] < A[0]: max1 = A[1]

Computer science or computer engineering for software engineer? The aim of this post is to contrast some computer terms used in the industry and academia as well. Some people are just curious to know the differences but for students in particular, realizing what these terms stand for is very important before deciding on a certain