Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Data Structure Articles
Page 22 of 164
Jacobsthal and Jacobsthal-Lucas Numbers
Jacobsthal Numbers Lucas sequence ππ(π, π) where P = 1 and Q = -2 are called Jacobsthal numbers. The recurrence relation for Jacobsthal numbers is, $$\mathrm{π½_π = 0\: πππ \: π = 0}$$ $$\mathrm{π½_π = 1\: πππ \: π = 1}$$ $$\mathrm{π½_π = π½_πβ1 + 2π½_{πβ2}\: πππ \: π > 1}$$ Following are the Jacobsthal numbers β 0, 1, 1, 3, 5, 11, 21, 43, 85, 171, 341, 683, 1365, β¦. Jacobsthal-Lucas Numbers Complementary Lucas sequence $\mathrm{π_π(π, π)}$ where P = 1 and Q = -2 are called JacobsthalLucas numbers. The recurrence relation for Jacobsthal-Lucas numbers is, $\mathrm{π½_π}$ = ...
Read MoreIncrement a number by 1 by manipulating the bits
Bit manipulation applies logical operations on a bit stream using bitwise operators like AND(&), OR(|), NOT(~), XOR(^), Left Shift() to get a required result. Using bitwise operators is beneficial as we can manipulate individual bits and they are faster than other operators. Problem Statement Given a number. Increment or add the number by 1 using bitwise operators only. (Donβt use arithmetic operators like β+β , β-β, β*β orβ/β ) Approach 1: Using Oneβs Complement / NOT Operator Bitwise complement / Oneβs complement is implemented using the NOT(~) Operator. For a number n, a bitwise complement of n i.e. ~n = ...
Read MoreSum of Fourth Powers of first N natural numbers
The fourth power of a number x is x raised to the power 4 or x4. Natural numbers are all positive integers excluding zero. Thus, the sum of the fourth powers of the first N natural numbers is β $\mathrm{Sum = 1^4 + 2^4 + 3^4 + 4^4 + β¦ + N^4}$ This article describes some approaches for finding the sum using minimum time and space complexity. Problem Statement Given the number N, find the sum $\mathrm{1^4 + 2^4 + 3^4 + 4^4 + β¦ + N^4}$. Example 1 Input: 3 Output: 98 Explanation $\mathrm{Sum = 1^4 + ...
Read MoreCentered Pentadecagonal Number
The problem includes printing the N-th centered pentadecagonal number for any input number N. A centered pentadecagonal number is a number that can be represented in the form of a figure with a dot in the centre and surrounded by successive layers of the pentadecagon i.e. 15-sided polygon. Here the successive layers of the pentadecagon depict that the first layer surrounding the dot in the centre will be 15-sided polygon, the next layer will be 30-sided polygon followed by a 45-sided polygon and so on. We can understand the concept of centered pentadecagonal with the below figures. The first ...
Read MoreCentered Octagonal Number
The problem statement includes printing the N-th centered octagonal number for some positive integer N, which will be given by the user. A centered octagonal number is a type of number which can be represented in a pattern of figures. Every centered octagonal number can be represented as a dot in the centre surrounded by the successive layers of an Octagon. An octagon is a type of polygon in geometry which has 8 sides in it. The successive layers of an octagon means that the first layer surrounding the dot in the centre will be an octagon, the second ...
Read MoreCentered Octadecagonal Number
The problem includes to print the N-th centered octadecagonal number, where N will be given as an input. A centered octadecagonal number is a type of figurative number which is represented as a dot in the centre surrounded by the successive layers of the octadecagon. An octadecagon is a polygon with 18 sides in it. The successive layers of the octadecagon are the first layer will be 18-sided polygon, the next will be 36-sided polygon and so on. The numbers can be better explained with the help of figures. The first number is represented as a dot in the ...
Read MoreCentered nonadecagonal number
The problem statement includes printing of the N-th centered nonadecagonal number for any positive value of N. A centered nonadecagonal numbers are numbers which are represented in a particular pattern of figure. This number can be represented in a figure as a dot in the centre surrounded by the successive layers of the nonadecagon. A nonadecagon is a type of polygon in mathematics which has 19 sides in it. The successive layers of the nonadecagon suggests that the first layer surrounding the dot in the centre will be 19 sided polygon followed by 38 sided polygon and so ...
Read MoreCentered dodecahedral number
The problem statement says to print the N-th centered dodecahedral number for any positive value of N which will be the user input. A centered dodecahedral number is a number that can be represented in a particular pattern of figure. A dodecahedron is a three-dimensional figure in mathematics which has 12 flat faces. And a centered dodecahedral number is a number which can be represented in the form of a figure with a dot in the centre surrounded by the successive layers of the dodecahedron (12 faced 3-d structure). The successive layers of the dodecahedron says the first layer will ...
Read MoreCentered cube number
The problem statement includes printing the N-th centered cube number for some positive value of N, which will be the user input. A centered cube number is the number of points in a three-dimensional pattern created by a point surrounded by concentric cubical layers of points, with i^2 points on the square faces of the ith layer. It is equivalently the number of points in a body-centered cubic pattern within the cube with n + 1 points along each of its edges. You can refer to wikipedia for figurative representation of the centered cube number which will help in better ...
Read MoreDifference between Static and Dynamic Hashing
Hashing is a computation technique in which hashing functions take variable-length data as input and issue a shortened fixed-length data as output. The output data is often called a "Hash Code", "Key", or simply "Hash". The data on which hashing works is called a "Data Bucket". Characteristics of Hashing Technique Hashing techniques come with the following characteristics β The first characteristic is, hashing technique is deterministic. Means, whatever number of times you invoke the function on the same test variable, it delivers the same fixed-length result. The second characteristic is its unidirectional action. There is no way you can ...
Read More