Enable contrast version

# Tutor profile: Cody H.

Inactive
Cody H.
Perception Algorithm Developer for Autonomous Vehicles - Mathematician and Problem Solver
Tutor Satisfaction Guarantee

## Questions

### Subject:Python Programming

TutorMe
Question:

Python lacks an or-equals operator. This may tempt some users into using |= as a substitute (the bitwise or-equals). However, it's not exactly the same. What is the difference between: x = x or (...) and x |= (...) given that the (...) are identical in the two cases?

Inactive
Cody H.

You are probably familiar with the idea that boolean operations short-circuit in most programming langauges: "true or (...)" does not require the second expression to be evaluated to know for a fact that the result of the entire computation is true. What is sneaky here is that bitwise-or cannot short-circuit, because the value of every bit needs to be computed, not just the true/false value (the only things that even could short circuit in theory would be all 1's with a bitwise or, and all zeros with a bitwise and, but remember "true" is usually represented as the integer 1, or ...000001 in binary), therefore using bitwise or instead of boolean or can cause expressions to be evaluate that would otherwise be short-circuited. If x = true, then "x = x or CrashComputer()" would not run CrashComputer(). However "x = x | CrashComputer()" would, perhaps unfortunately, run CrashComputer().

### Subject:C++ Programming

TutorMe
Question:

Given an input array of size N, and the task of finding some element within the array that has the property P, under what circumstances is it possible for there to exist a solution with time complexity less than O(n)?

Inactive
Cody H.

We must a priori know something about the relationship between elements of the array, so that we can learn things about elements without looking at all of them. In general, we can say the input data must be structured. Examples of structure include: sorted, all elements equal, partitioned by some property; however there are, of course, infinite possibilities for ways that data can be structured.

### Subject:Artificial Intelligence

TutorMe
Question:

Is it possible for alpha-beta pruning to change the final output of the algorithm? Why or why not?

Inactive
Cody H.

No, because alpha-beta pruning only removes branches of the tree that are known to be worse than some other option available. An example of "pseudo" alpha-beta pruning is when humans play chess, if we see that a certain move will cause us to lose our queen without immediately checkmating the opponent, we will stop calculating this line of play and look at other lines which don't lose our queen. This is only "psuedo" alpha-beta pruning because we don't know for a fact that losing our queen is bad until we've seen that it leads to our getting checkmated, at which point there would be no pruning occurring (because we've computed all the way to the end of the game tree).

## Contact tutor

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

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.
BEST IN CLASS SINCE 2015
TutorMe homepage