Tagged: Beginner

0

Convert Roman Number to Integer

Objective: Given a Roman number, write a program to convert it to Integer. Roman Number –   Letters used in Roman numerals and the corresponding numerical values are given in the table below. Rules: ...

0

Linear Search vs Binary Search

Earlier we have seen linear search and binary search and how these work individually, In this article we will compare these two search algorithms. If you are new to these, please read the prerequisites...

0

Count the number of nodes in a given binary tree

Objective: Given a binary tree, write an algorithm to count all the nodes in the tree. Example: Approach: Do postorder traversal. If the root is null return 0. (base case all well for the...

0

Longest contiguous character in a given String – O(N) Solution

Objective: Given an input string, write an algorithm to find the longest contiguous character or in other words, find a maximum consecutive character in the string. Example: Input: “aaabbccccddbbaaa” Output: c, count = 4...

0

String to Integer (AtoI – ASCII to Integer)

Objective: Implement atoi, which converts string to an integer. Rules for converting string to an integer. If the string is null or empty, Integer will be 0. The first character of string may represent...

0

Find all Prime Numbers less than equal to N | Set 1

Objective: Given a number N, Write a program to find all prime numbers which are between 0 and N. Prime Number : A prime number is a natural number that has exactly two distinct...

0

Find third largest element in a given array

Objective: Given an array of integers, write an algorithm to find the third largest element in the array. Example: Int [] a = { 6, 8, 1, 9, 2, 1, 10} Output: Third largest...

0

Stack Java Class – Explained

Earlier we saw about Stack and its implementation using Linked List. Java has a built in class for Stack. In this article we will discuss about it in detail. First brief about Stack. What...

%d bloggers like this: