Tutor profile: Josh T.
What's the difference between the passé composé and l'imparfait?
While both tenses are used to express something that happened in the past, their usage differs greatly, though this difference may elude many English speakers, since we don't have two clear tenses that correlate directly to the passé composé and l'imparfait. The passé composé is used when there's definition in the event that happened in the past. That's to say, we know when the event ended, or exactly how long it lasted. Also, importantly, the event is no longer going on; the event happened in the past and finished in the past. Commonly, we're told the passé composé is used for one single action in the past, though this can be misleading since the passé composé can also be used for something that occurred multiple times (but not habitually), but had a definite start and end. For example, saying the sentence, "Humanity fought humanity twice," to allude to the two World Wars, you would say, "L'humanité a lutté contre l'humanité deux fois." This detail is important, as l'imparfait is also used to express something that happened multiple times, which leads to a lot of confusion on the two tenses. Though there's this perceived similarity, there's a keen difference. In general, l'imparfait is used to express habit. That's to say, something that happened habitually. For example, "I went to the café every day while I was in France," would be "J'allais chaque jour au café pendant mon séjour en France." You'll notice me going to the café was a habit; it's something I did over and over again, and there's no clear number of times that it happened, nor is there any clear point where it began or ceased. In more "nit-picky" cases, l'imparfait is also used when giving a description in a story (like setting the scene), and is typically used when we would use the past progressive here in English. For example, if I'm telling a story and I say, "The sun was shining," I would say in French, "Le soleil brillait."
Subject: Computer Science (General)
What's an AVL tree and when should it be used?
An AVL tree is a data structure that very closely resembles a Binary Search Tree (BST). In fact, it IS a BST, but with a few extra "quirks". The problem that was noticed with a BST is that, based on how data was added to the tree, you could very easily end up with trees that were "lop-sided". That's to say, some of the tree's leaves had very great depths while others did not. As a result, looking for something in the tree could start to get very tedious, especially since it didn't HAVE to be tedious if the tree were just more balanced. As a result, the AVL tree is a BST that balances whenever a node is added. When a proper place is found for a node, it's inserted and then an algorithm traverses the tree from that node to the root, balancing as it goes. This balancing process involves swapping child nodes with their parent (while maintaining the rules of a BST) to create more balanced subtrees. The larger result is that the height of the left subtree of the root is very close to the height of the right subtree of the root. This results in a BST that's optimized for searching. However, the downside of an AVL tree is that the process for insertion of a new node can be tedious, since it needs to balance all the way up to the root. So, as with all things in computer science, your choice of data structure matters, and your specific data and case should be considered. If you need highly optimized search times, but don't mind if insertion is a little slow, then an AVL tree is perfect.
Subject: C Sharp Programming
What's a class?
The 'class' is a fundamental component of Object-Oriented programming languages. In a pure OO language (like C#), everything is a class, or a field/property/method of a class. A class, as it pertains to C#, represents a custom user-defined data type. These types contain fields, properties, and methods. Fields and properties represent the data and information tied to the type. Methods, the object-oriented equivalent of functions, represent actions that are inherent to that type. For example, suppose we define a class called "Person". The Person class contains two fields (name and age), two properties (Name and Age (allowing secure and more controlled access to and mutation of this data from code outside the class)), and two methods (Walk and SayName). You'll notice the fields act as containers for relevant data--all objects of the Person class (which we could just call "people") have a name and an age, so the class contains a definition for those values. The methods are the things people can do. Our Person is very limited, and can only Walk and say their name (via SayName). You'll notice methods have names that imply some kind of action. That's because methods do something. In short, classes allow us to create a blueprint for a type of "thing" that exists in our program.
needs and Josh will reply soon.