- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Rishikesh Kumar Rishi has Published 1162 Articles
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
Rishikesh Kumar Rishi
1K+ Views
ExamplesApproach to solve this problemStep 1 − Define a method that accepts the head of a linked list.Step 2 − If head == nil, return; else, call ReverseLinkedList, recursively.Step 3 − Print head.value at the end.Example Live Demopackage main import "fmt" type Node struct { value int next *Node ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
Rishikesh Kumar Rishi
5K+ Views
ExamplesApproach to solve this problemStep 1 − Define a method that accepts the head of the linked list.Step 2 − Initialize a variable, count := 0.Step 3 − Iterate the given linked list till it reaches the last node.Step 4 − Increase the count by 1 in the loop.Step 5 ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
Rishikesh Kumar Rishi
432 Views
ExamplesApproach to solve this problemStep 1 − Let’s define a structure of the node.Step 2 − Make the Linked List such that the previous node would store the address of the next node.Example Live Demopackage main import "fmt" type Node struct { value int next *Node } func NewNode(value ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
Rishikesh Kumar Rishi
3K+ Views
ExamplesFor example, n = 1 (Binary Representation of 1: 1)For example, n = 5 (Binary Representation of 5: 101)For example, n = 20 (Binary Representation of 5: 10100)For example, n = 31 (Binary Representation of 31: 11111)Approach to solve this problemStep 1 − Define a method that accepts an integer, ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
Rishikesh Kumar Rishi
587 Views
ExampleSuppose we have the following binary tree.Preorder Tree Traversal Output: 1, 2, 4, 5, 3, 6, 7.Approach to solve this problemStep 1 − If the root node of the given tree is nil, then return; else, follow the steps given below.Step 2 − Print the root node data.Step 3 − ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
Rishikesh Kumar Rishi
240 Views
ExamplesFor example, arr = [1, 4, 5, 1, 4, 5, 1] => Odd-occurring element in the array is: 1Approach to solve this problemStep 1 − Define method that accepts an array.Step 2 − Declare a xor variable, i.e., xor := 0.Step 3 − Iterate input array and perform xor operation ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
Rishikesh Kumar Rishi
156 Views
ExamplesFor example, n = 12 => 12 is not the power of 4.For example, n = 64 => 64 is the power of 4.Approach to solve this problemStep 1 − Define a method that accepts a number n.Step 2 − Divide log(n) by log(4), store in res.Step 3 − If ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
Rishikesh Kumar Rishi
125 Views
ExamplesFor example, n = 12 => Previous number power of 2 is 8.For example, n = 20 => Previous number power of 2 is 16.Approach to solve this problemStep 1 − Define a method that accepts a number n.Step 2 − Perform n | (n >> k), where k is ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
Rishikesh Kumar Rishi
414 Views
ExamplesFor example, n = 12 => Next number power of 2 is 16.For example, n = 20 => Next number power of 2 is 32.Approach to solve this problemStep 1 − Define method, that accepts a number n.Step 2 − Iterate k := 1 until k < n.Step 3 − In a loop, calculate k
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
Rishikesh Kumar Rishi
169 Views
ExamplesFor example, x = 12, y = 15 => Maximum number is 15.For example, x = 13, y = 17 => Minimum number is 13.Approach to solve this problemStep 1 − Define method, findMax and findMin, that accept two integer x and y.Step 2 − Return integer according to defined ... Read More