
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Server Side Programming Articles - Page 1359 of 2650

415 Views
Let us first define our linked list that contains data and the pointer to the next node.struct Node { int data; struct Node* next; };Next we create our createNode(int data) function that takes int data as parameter and returns the newly created node after assigning the parameter value. The next pointer to the node will be null.Node* createNode(int data){ struct Node* newNode = new Node; newNode->data = data; newNode->next = NULL; return newNode; }Now we have our deleteMiddle(struct Node* head) function which takes the root node. If the root node isn’t null then it ... Read More

148 Views
Let us first define the struct that would represent a tree node that contains the data and its left and right node child. If this is the first node to be created then it’s a root node otherwise a child node.struct Node { int data; struct Node *leftChild, *rightChild; };Next we create our newNode(int data) function that takes an int value and assign it to the data member of the node. The function returns the pointer to the created struct Node. Also, the left and right child of the newly created node are set to null.struct Node* newNode(int ... Read More

215 Views
Let us first define the struct that would represent a tree node that contains the data and its left and right node child. If this is the first node to be created then it’s a root node otherwise a child node.struct Node { int data; struct Node *leftChild, *rightChild; };Next we create our newNode(int data) function that takes an int value and assign it to the data member of the node. The function returns the pointer to the created struct Node. Also the left and right child of the newly created node are set to null.struct Node* newNode(int ... Read More

575 Views
Let us first define the original array and the exclusive range for deletion of the array elements and also find the original array length −int arr[] = { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20}; int L = 2, R = 6; int length = sizeof(arr) / sizeof(arr[0]);Now we loop in the array and if index position (i) is greater than L or R we increment the variable k which will be used to shift positions(delete) of array element once the index value (i) lies between the range L and R. Also, the new length of the ... Read More

401 Views
Suppose we have two strings s and t of same size. We have to check whether s and t are equivalent or not. There are few conditions to check:They both are equal. Or, If we divide the s into two contiguous substrings of same size and the substrings are s1 and s2 and also divide t same like, s into t1 and t2, then one of the following should be valid:s1 is recursively equivalent to t1 and s2 is recursively equivalent to t2s1 is recursively equivalent to t2 and s2 is recursively equivalent to t1So, if the input is like ... Read More

429 Views
Suppose we have two strings s and t we have to check whether they are anagram of each other or not.So, if the input is like s = "bite" t = "biet", then the output will be True as s ad t are made of same characters.To solve this, we will follow these steps −if size of s is not same as size of t, thenreturn Falsesort characters of s and treturn true if s is exactly same as t, otherwise falseLet us see the following implementation to get better understanding −Example CodeLive Demodef solve(s, t): if len(s) != ... Read More

921 Views
Suppose we have three sides. We have to check whether these three sides are forming a triangle or not.So, if the input is like sides = [14,20,10], then the output will be True as 20 < (10+14).To solve this, we will follow these steps −sort the list sidesif sum of first two sides

425 Views
Suppose we have a string s. We have to check whether the vowels present in s are in alphabetical order or not.So, if the input is like s = "helloyou", then the output will be True as vowels are e, o, o, u all are in alphabetical order.To solve this, we will follow these steps −character := character whose ASCII is 64for i in range 0 to size of s - 1, doif s[i] is any one of ('A', 'E', 'I', 'O', 'U', 'a', 'e', 'i', 'o', 'u'), thenif s[i] < character, thenreturn Falseotherwise, character := s[i]return TrueLet us see ... Read More

500 Views
Suppose we have two numbers x and y. We have to check whether these two numbers differ at one-bit position or not.So, if the input is like x = 25 y = 17, then the output will be True because x = 11001 in binary and y = 10001. Only one-bit position is different.To solve this, we will follow these steps −z = x XOR yif number of set bits in z is 1, thenreturn Truereturn FalseLet us see the following implementation to get better understanding −Example CodeLive Demodef bit_count(n): count = 0 while n: ... Read More