Tag

Fundamentals

Browsing

The queue is an abstract data type, in which the element is inserted into the tail, and delete from the head. It stores the items using First in first out principle (FIFO). The queue can be implemented using an array or linked list. The enqueues insert an item to the tail. The dequeue removes the item from the head.

Armstrong Number An Armstrong Number is a number that is the sum of its own digits each raised to the power of the number of digitsArmstrong numbers are those numbers in which sum of cube of all digits provides the same number.Example:-1531^3 = 15^3 = 1253^3 = 271^3 + 5^3 + 3^3= 1 + 125 + 27= 153 Source Code package com.dsacode.Probelms; public class ArmstrongNumer { public static boolean isArmStrong(int num) { int result = 0; int orig = num; while(num != 0){ int remainder = num%10; result = result + remainder*remainder*remainder; num = num/10; } if(orig == result){ return…

Least Significant Digit (LSD) radix sort process the integer representations starting from the least digit and moves towards the most significant digit. Radix sort is a linear sorting algorithm that sorts data with integer keys by grouping keys by the individual digits which share the same significant position and value.