-
Characteristics of an Algorithm
List out the characteristics of an algorithm
-
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)?
-
-
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?
-
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.
-
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.
-
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.
-
-
Read the Day and the Weather
A club plays cricket only on Sundays and only if it is not raining. Read the day and the weather and "Game on" if the weather is good and the day is Sunday, or "Play Suspended" if it is not Sunday and it is raining.
-
Calculate Number of Oil Pipes Required
Pipes are laid by an oil company. If the company has to laid down 3 km of pipe and each pipe is 25 metres long, calculate and print the number of pipes needed to cover the distance.
-
Linked List
How will you reverse a singly linked list?
-
-
Distinct palindromic sub strings
I want to calculate number of DISTINCT palindromic substrings in a string.How to do it?
Like if aba is string the their are 3 distinct palindromic subsrings:{a,aba,b}
length of string could be 10^5 range.So i dont think O(n^2) solution will work.I want a algorithm to do this in less than O(n^2). -
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
-
Algorithm help
Create the flowchart and algorithm for a module that will prompt the user to enter the amount of cash they have in their pocket. The program should output “Not Enough” ($0 - $0.64), “Vending Machine” ($0.65 - $1.99), “Fast Food” ($2.00 - $4.99), “Cafeteria” ($5.00 - $14.99) or “Steak House” ($15 and up) depending on what the user can afford for lunch.
-
Python - How to Write a function
How to Write a function kinda_format ( ) that take three arguments (each of which positive int ) - a,b,c- and tests whether the equality a^n +b^n=c^n holds for each n{2,3,...,10}. The function should return false if the equality does not hold for any value of n in the given range, and if there is a value of n for which the equality holds, the lowest such value (as in int)
-
Finding a 'circle' in a linked list
You have n numbrer Node objects - could be 1,000,000 for all you know. Each Node has a getNext() method that returns the next Node (a linked list).But the chain of n number of Node objects linked together by the getNext() method, somewhere in the chain, points back to a Node earlier in the chain so if you keep calling getNext() to walk the chain you will never get to the last Node - it will loop forever.What...
-
Compute Average of Two Scores
Describe an algorithm to compute the average of two scores obtained by each of the 100 students
-
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?
-
Post Order Binary Tree Traverse
Design a conventional iterative algorithm to traverse a binary tree represented in two dimensional array in postorder.
Algorithm Questions
Ans