-
A(x) + a(y) = M
Given a1, a2, .... a(n) integers & M, return true or false if there exist a(x) + a(y) = MOnce you're done, do it using a hash table.
-
Recursion
What is recursion? Which data structure is used for recursion
-
Compute Average of Two Scores
Describe an algorithm to compute the average of two scores obtained by each of the 100 students
-
Calculate Money Paid to Each Worker
A carpenter is paid a contract fee of $2000.00 for 3 days work. He hires 3 workers who work for the 3 days at $75.00 a day: calculate and print the amount of money paid to each worker; the total paid to all workers and the amount the carpenter is left with.
-
To calculate distance between two text strings
Give an algorithm that calculates the distance between two text strings (only operations you can have are: delete, add, and change, one by one).
-
Pseudocodes and flowcharts
When twice a certain number is subtracted from five times itself, the result equals 60. Find the number by using the try and error method. Use both pseudocode and flowchart.
-
-
Array Values Algorithms
How many values can be held by an array with dimensions A(0:n), B(-1:n,1:m), C(-n:0,2)?
-
Calculate Primary and Secondary Diagonal
Write an algorithm that calculates all the elements of rows and columns of a square matrix and calculate the total of primary and secondary diagonal.
-
How can you traverse a matrix of m lines and n columns in a zig-zag way ?
Example : 1)m = 3,n = 2 a11 a12 a21 a22a31 a32Output : a11 a21 a12 a31 a22 a322) m = 3, n = 4a11 a12 a13 a14a21 a22 a23 a24a31 a32 a33 a34Output : a11 a21 a12 a31 a22 a13 a32 a23 a14 a33 a24 a34
-
-
Linked List Kth largest Element
How to find the kth largest element in a linked list? Can you do this without using extra memory and also without modifying (sorting) the list?
-
Strings as input
Implement an algorithm that takes two strings as input, and returns the intersection of the two, with each letter represented at most once. Speed it up and test it.
-
-
Duplicate Elements Array
You have an array of size '2n' of these, 'n+1' elements are distinct and 1 element is repeated 'n' times. You must find the repeated element and say how many times it has repeated. Your solution must use minimum no. of comparisons. Also, say how many comparisons your solution will make in the worst case?
-
Linked List
How will you reverse a singly linked list?
-
Sorted Matrix
You are given a matrix. The matrix elements are such that they are sorted both horizontally and vertically. Given an element of the matrix, your job is to obtain its position in an efficient manner.Example: 10 20 30 15 35 98 48 76 110Input: 76Output: 3rd row, 2nd column.
-
-
-
Algorithm Questions
Ans