Enable contrast version

# Tutor profile: Siddhanth D.

Inactive
Siddhanth D.
Teaching Assistant at BITS Pilani K. K. Birla Goa Campus University
Tutor Satisfaction Guarantee

## Questions

### Subject:Java Programming

TutorMe
Question:

How to Find All Permutations of String in Java using Recursion? For example, given a String "123", this program will print all 6 possible permutations of input. Output: 123 132 213 231 312 321

Inactive
Siddhanth D.
Answer:

public class StringPermutations { public static void main(String args[]) { permutation("123"); } public static void permutation(String input){ permutation("", input); } /* Recursive method which actually prints all permutations of given String, but since we are passing an empty String as current permutation to start with, I have made this method private*/ private static void permutation(String perm, String word) { if (word.isEmpty()) { System.err.println(perm + word); } else { for (int i = 0; i<word.length(); i++) { permutation(perm + word.charAt(i), word.substring(0, i) + word.substring(i+1,word.length())); } } } } Output: 123 132 213 231 312 321

### Subject:Biology

TutorMe
Question:

Is it completely random whether a baby is a boy or a girl?

Inactive
Siddhanth D.
Answer:

One possible end result of a meiosis error is the spermatocyte becoming the four sperm cells: X, 0, XY, and Y. In this case, the Y chromosome that was supposed to end up in its own sperm failed to separate from its X chromosome partner. As a result, one sperm abnormally contains both an X and a Y chromosome while another sperm contains no sex chromosomes. Keeping in mind that the mother always provides an X chromosome (or multiple X chromosomes in abnormal situations), the four possible babies from these four sperm cells are: XX, X, XXY, and XY. The XX possibility is a normal girl, the X possibility is a girl with Turner syndrome, XXY is a boy with Klinefelter syndrome, and XY is a normal boy.

### Subject:C++ Programming

TutorMe
Question:

Traverse a binary tree in the inorder fashion without using recursion and without using a stack as well.

Inactive
Siddhanth D.
Answer:

#include <stdio.h> #include <stdlib.h> struct tNode { int data; struct tNode* left; struct tNode* right; }; void MorrisTraversal(struct tNode* root) { struct tNode *current, *pre; if (root == NULL) return; current = root; while (current != NULL) { if (current->left == NULL) { printf("%d ", current->data); current = current->right; } else { pre = current->left; while (pre->right != NULL && pre->right != current) pre = pre->right; if (pre->right == NULL) { pre->right = current; current = current->left; } else { pre->right = NULL; printf("%d ", current->data); current = current->right; } } } } struct tNode* newtNode(int data) { struct tNode* node = new tNode; node->data = data; node->left = NULL; node->right = NULL; return (node); } int main() { struct tNode* root = newtNode(1); root->left = newtNode(2); root->right = newtNode(3); root->left->left = newtNode(4); root->left->right = newtNode(5); MorrisTraversal(root); return 0; }

## Contact tutor

Send a message explaining your
needs and Siddhanth will reply soon.
Contact Siddhanth

## Request lesson

Ready now? Request a lesson.
Start Lesson

## FAQs

What is a lesson?
A lesson is virtual lesson space on our platform where you and a tutor can communicate. You'll have the option to communicate using video/audio as well as text chat. You can also upload documents, edit papers in real time and use our cutting-edge virtual whiteboard.
How do I begin a lesson?
If the tutor is currently online, you can click the "Start Lesson" button above. If they are offline, you can always send them a message to schedule a lesson.
Who are TutorMe tutors?
Many of our tutors are current college students or recent graduates of top-tier universities like MIT, Harvard and USC. TutorMe has thousands of top-quality tutors available to work with you.